[Previous] [Contents] [Next]


Displaying Database Structure with SHOW


Details of databases, tables, and indexes can be displayed with the SHOW command. The SHOW command isn't part of the SQL standard and is MySQL-specific. It can be used in several ways:

SHOW DATABASES

Lists the databases that are accessible by the MySQL DBMS.

SHOW TABLES

Shows the tables in the database once a database has been selected with the use command.

SHOW COLUMNS FROM tablename

Shows the attributes, types of attributes, key information, whether NULL is permitted, defaults, and other information for a table. For example:

SHOW COLUMNS FROM customer

shows the attribute information for the customer table. DESCRIBE table produces the same output.

SHOW INDEX FROM tablename

Presents the details of all indexes on the table, including the PRIMARY KEY. For example:

SHOW INDEX FROM customer

shows that there are two indexes, the primary index and the names index.

SHOW STATUS

Reports details of the MySQL DBMS performance and statistics.


[Previous] [Contents] [Next]