SHOW TABLES

This MySQL statement displays a list of MySQL tables and views. To distinguish between MySQL tables and views, add the FULL keyword.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

SHOW [FULL|OPEN] TABLES [FROM database] [LIKE 'pattern'| WHERE expression]

Explanation

This MySQL statement displays a list of MySQL tables and views (as of version 5.0.1 of MySQL). To distinguish between tables and views, add the FULL keyword. In the results, an extra column called Table_type will be displayed. A value of BASE TABLE indicates a table, VIEW indicates a view. The tables shown will not include temporary tables and will be from the current database by default. To list tables from another database, add the FROM clause along with the name of the database. You can reduce the list of tables to ones with a name meeting a given naming pattern with either the LIKE or the WHERE clause. For a list of all MySQL tables for all MySQL databases that are currently being used by queries, add the OPEN flag instead.

Examples

SHOW TABLES FROM workrequests LIKE 'work%';

This statement will list all of the tables and views with a name that begins with the word work for the database workrequests. By default, only tables for which the user has privileges will be listed.

From the command-line, the utility mysqlshow with the --keys option can be used to show the tables contained in a database:

mysqlshow --user=user --password database