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

解决方案 »

  1.   

    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
      

  2.   

    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')
    ;
      

  3.   

    回复人:yangxiao_jiang(哈哈) ( 四级(中级)) 信誉:100如果最小的有几张表而且一样呢?
      

  4.   

    我是楼主,我郁闷了!
    服务器上的mysql没有information_schema数据库~ 
    估计在这个问题上我只能止于此了,谢谢大家。