Name
SHOW TABLES
Synopsis
SHOW [OPEN] TABLES [FROMdatabase
] [LIKE 'pattern
']
This statement displays a list of
tables. For a listing of tables that is currently being used by
queries, add the OPEN
flag. The tables shown will
not include temporary tables and will be from the current default
database. 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. As of Version 5.0.1 of MySQL, the results set will
include tables and views for the database. It will also include a
second column to specify whether a row is for a table or a view. This
is indicated by the values of BASE TABLE
and
VIEW
, respectively.
SHOW TABLES FROM workrequests LIKE 'work%';
This statement will list all of the tables and views (if the server is running Version 5.0.1 or higher) with a name that begins with the word “work,” for the database workrequests. Incidentally, by default, only tables for which the user has privileges will be listed.
Get MySQL in a Nutshell 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.