mysql 查看数据库中所有表的记录数

Mysql 查看所有表的记录数


MySQL使用select count(*) from table_name可以查询某个表的总记录数。想快速的知道数据库中所有表的记录数信息怎么办?如果使用mysql的版本在5.0及以上,可以通过查询information_schema库中的tables表来获取,该表中使用table_rows记录表的行数信息。例如查看库sinaif_market中所有表的记录数:

use information_schema;

select table_name,table_rows from tables 
where TABLE_SCHEMA = 'sinaif_market' 
order by table_rows desc

Mysql 统计所有记录


select sum(table_rows) from tables 
where TABLE_SCHEMA = 'sinaif_market'



猜你喜欢

转载自blog.csdn.net/qing_mei_xiu/article/details/76064079