Updated on 2026-11-06 GMT+08:00

Show All Tables

Function

View all tables and views in the current database. Use IN/FROM to specify a database, and use LIKE for pattern matching filtering.

Syntax

SHOW TABLES [ { FROM | IN } db_name ] [ LIKE regex_expression ]

Parameters

Parameter

Mandatory

Description

FROM / IN

No

Specify the database name to view tables and views under a specific database. FROM and IN have the same function and are interchangeable.

db_name

No

Database name. If not specified, the current database is viewed by default. Naming rule: Only letters, digits, and underscores (_) are allowed. Cannot be purely numeric and cannot start with a digit or underscore.

LIKE regex_expression

No

Uses a regular expression for pattern matching filtering of table names.

Supports wildcards such as * (matches any sequence of characters) and | (OR).

Precautions

None

Example 1: View All Tables and Views in the Current Database

SHOW TABLES;

Example result:

+---------+---------+-----------+
|database |tableName|isTemporary|
+---------+---------+-----------+
|default  |employee |false      |
|default  |student  |false      |
|         |temp_view|true       |
+---------+---------+-----------+

Example 2: View All Tables in a Specified Database

View all tables in the company_db database.

SHOW TABLES FROM company_db;

Example 3: Use LIKE Pattern to Filter Table Names

View all tables in the current database whose names start with emp.

SHOW TABLES LIKE "emp*";

Example 4: View Tables with a Specific Prefix in a Specified Database

View all tables in the company_db database whose names start with dept.

SHOW TABLES IN company_db LIKE "dept*";