mysql统计库下所有表数据行数

一、执行下面sql

select concat(
'select "',
TABLE_name,
'", count(*) from ',
TABLE_SCHEMA,
'.',
TABLE_name,
' union all'
) from information_schema.tables
where TABLE_SCHEMA='test';

二、执行上面sql后会批量生成sql

三、把生成的sql拷出来,并去掉最后的一个“union all”:

猜你喜欢

转载自www.cnblogs.com/yanpan/p/10043466.html