MySQL 查询数据库表的数量
MySQL 查询数据库表的数量
1.获取指定数据库的表的数量
SELECT COUNT(*) TABLES, table_schema FROM information_schema.TABLES GROUP BY table_schema;
2.获取mysql下所有数据库表的数量
SELECT COUNT(*) TABLES, table_schema FROM information_schema.TABLES
WHERE table_schema = '数据库名' GROUP BY table_schema;
查询当前库所有表数据量
SELECT
TABLE_NAME,TABLE_ROWS
FROM
information_schema.`TABLES`
WHERE
TABLE_SCHEMA = (
SELECT
database
())
ORDER
BY
TABLE_ROWS
DESC
;
REF
https://baijiahao.baidu.com/s?id=1605681796772603432&wfr=spider&for=pc