日期:2014-05-16  浏览次数:20894 次

如何查询表名
mysql
在数据库db_name中有很多表,我想查询记录条数最少的那一张表的表名,有什么好办法啊?谢谢

------解决方案--------------------
use information_schema
select TABLE_NAME,TABLE_ROWS from TABLES where TABLE_SCHEMA= 'db_name ' and TABLE_ROWS is not null order by TABLE_ROWS limit 1

------解决方案--------------------
use information_schema;
select table_name from tables where table_schema = 'db_name ' and
table_rows in (select min(table_rows) from tables where table_schema= 'db_name ')
;