首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

怎么查询表名

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

如何查询表名
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 ')
;

热点排行