Skip to content

By plogi in mysql questions

 

Find as many ways as possible to determine the name and schema of the table with the most rows inside your mysql-instance.

Hint: Use the information schema.

[ Obtaining Database Metadata (10%) - Using INFORMATION_SCHEMA to Obtain Metadata ]

Tags: , ,

Comment Feed

One Response

  1. plogi17. May 2010 @ 19:22:33


     
    Here are some possibilities:
     

    select * from information_schema.tables
      where table_rows=
      (select max(table_rows) from information_schema.tables);
    
    select * from information_schema.tables
      order by table_rows desc limit 1;
    
    select v1.* from information_schema.tables v1,
      (select max(table_rows) as mtr from information_schema.tables) v2
      where v1.table_rows=v2.mtr;
    
    set @a=(select max(table_rows) from information_schema.tables);
    select * from information_schema.tables where table_rows=@a;
    

     

    What kind of solutions did you find?

You must be logged in to post a comment.