SHOW TABLES lists all base and view tables in a MySQL database, optionally filtered by pattern or WHERE clause.
Run SHOW TABLES;
after connecting to the desired database. MySQL returns every base table and view in that schema.
Append LIKE 'pattern%'
or a WHERE
clause.This limits the result set to tables whose names match the expression, speeding up discovery in large schemas.
Qualify the database with FROM db_name
or switch databases using USE db_name;
before running SHOW TABLES
.
Use SHOW FULL TABLES
to add a Table_type
column that tells whether each entry is a BASE TABLE or VIEW.This helps separate logical objects from stored data.
Combine SHOW FULL TABLES
with a WHERE
filter: SHOW FULL TABLES WHERE Table_type = 'BASE TABLE';
.Views remain hidden.
Connect to the smallest scope necessary, use pattern filters early, and avoid running SHOW TABLES
repeatedly in scripts—cache results when possible.
The following snippet lists every table starting with Order
in the ecommerce
schema so that analysts can quickly locate order-related objects.
SHOW TABLES FROM ecommerce LIKE 'Order%';
.
You need the SHOW DATABASES
privilege globally or SELECT
privilege on the specific database to view its tables.
Query information_schema.tables
for advanced filtering, joins, or pagination when SHOW TABLES syntax feels limiting.
SHOW TABLES ignores session-temporary tables. Instead, query information_schema.innodb_temp_table_info
or inspect your session metadata.