Getting Information about Databases and Tables

MySQL provides several statements for getting information about databases and the tables in them. These statements are helpful for keeping track of the contents of your databases and for reminding yourself about the structure of your tables. You can also use them as an aid to using ALTER TABLE; it's easier to figure out how to specify a change to a column when you can find out how the column is defined currently.

The SHOW statement can be used to obtain information about several aspects of your databases and tables:

SHOW DATABASESList databases on server
SHOW TABLESList tables in current database
SHOW TABLES FROM db_name List tables in named database
SHOW COLUMNS FROM tbl_name Display information about ...

Get MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.