The SHOW TABLES statement lists the tables in a database. Tables can be standard tables as well as virtual tables representing views.

While a table is being dropped, SHOW TABLES will list the table with a (dropped) suffix.

Synopsis

SHOW TABLES FROM name

Required Privileges

No privileges are required to list the tables in a database.

Parameters

Parameter Description
name The name of the database for which to show tables. This is optional when showing tables in the default database.

Examples

Show tables in the default database

This example assumes that the bank database has been set as the default database for the session, either via the SET DATABASE statement or in the client’s connection string.

> SHOW TABLES;
+---------------+
|     Table     |
+---------------+
| accounts      |
| user_accounts |
+---------------+
(2 rows)

Show tables in a non-default database

> SHOW TABLES FROM startrek;
+-------------------+
|       Table       |
+-------------------+
| episodes          |
| quotes            |
| quotes_per_season |
+-------------------+
(3 rows)

See Also



Yes No