目录

MySQL查询当前数据库中所有记录不为空的表并列出数据量

目录

MySQL查询当前数据库中所有记录不为空的表并列出数据量

– 查看数据库 a  的表名和数据量  table_name(表名),table_rows(数据量)

 select table_name,table_rows from tables where TABLE_SCHEMA = 'a'  ;

– 查看当前数据库a 有记录的TABLE_NAME(表名)

 select TABLE_NAME ,table_rows from information_schema.tables where TABLE_SCHEMA='a' and table_rows>0;

– 查看数据库记录为空的表名和数据量TABLE_NAME (表名),table_rows(数据量)


 select TABLE_NAME ,table_rows from information_schema.tables where TABLE_SCHEMA='a' and table_rows = 0;

– 查看当前数据库 有记录的表名和数据量 并分组

 use information_schema; 
 select table_name,table_rows from tables  where TABLE_SCHEMA = 'ls_tx' and table_rows>0 order by table_rows desc;

注: use information_schema;  一定要有