查询数据库中表数量和各表中数据量

1.查询某个数据库下有多少张表

SELECT COUNT(*) TABLES FROM information_schema.TABLES WHERE table_schema = '替换成你的数据库名';

2.查询某个数据库下每个表有多少条数据

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,table_rows
from information_schema.tables where TABLE_SCHEMA = '替换成你的数据库名';

猜你喜欢

转载自www.cnblogs.com/linliquan/p/12096807.html