Show or list tables in a MySQL database

Contributor Icon Contributed by webgod  
Tag Icon Tagged: MySQL  

Once you have selected a database, you can list the tables in it by using the show command.


To view all of the tables in the selected database, use:

SHOW TABLES;
[code]
To view all of the tables in a different database that isn't selected:

[code]SHOW TABLES IN other_database;

If you are looking for a specific table but don't remember it's exact name, you can use a wildcard with either of the above commands. For example, to find tables ending in "user" from the database "bigdb" use:

SHOW TABLES IN bigdb LIKE '%user';

 

6 Comments -


  1. Code-like-hell-Programmer said on October 4, 2008

    tnx…this was what im looking for…oh BTW can i request something can you post a thourough guide in connecting jsp with mysql…if you would be kind enough to include instructions in setting paths and etc…i would greatly appreciate in…thanks in advance…and good job…

  2. Mahmudul said on February 5, 2009

    It work’s.
    Exactly what I was looking for.

  3. novice_programmer said on April 9, 2009

    thanks man,its cool

  4. Anon said on December 1, 2010

    and what if you don’t know the name of any other databases but know they’re there?

  5. Ragupathynan said on December 2, 2010

    good job…

  6. Tony said on December 10, 2010

    show databases;

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -