Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

List All The Tables In Your MySQL Database

From Wiki

Jump to: navigation, search

Sometimes you want to quickly see all the tables in your MySQL database. How can you do this? You can use the ANSI SQL Information Schema views to do this

To list all tables run the query below

  1. SELECT *
  2. FROM INFORMATION_SCHEMA.TABLES
  3. WHERE TABLE_TYPE = 'BASE TABLE';

To list all non system views run the query below

  1. SELECT *
  2. FROM INFORMATION_SCHEMA.TABLES
  3. WHERE TABLE_TYPE = 'VIEW';

To list all system views run the query below

  1. SELECT *
  2. FROM INFORMATION_SCHEMA.TABLES
  3. WHERE TABLE_TYPE = 'SYSTEM VIEW';


To get a count of all the tables and views broken down by table, view and system view run this

  1. SELECT COUNT(*),TABLE_TYPE
  2. FROM INFORMATION_SCHEMA.TABLES
  3. GROUP BY TABLE_TYPE;


Contributed By --SQLDenis 14:56, 3 September 2008 (GMT)


Part of MySQL Programming Tips, Tricks And Hacks

580 Rating: 2.6/5 (10 votes cast)