docs / articles / Mariadb Show Tables: View All Your Databases at a Glance

Mariadb Show Tables: View All Your Databases at a Glance

Lisa Jul 26, 2026 2026-07-26 18:03:27

Ever found yourself in a scenario where you needed to list all tables in a MariaDB database but didn't know how? The SHOW TABLES statement is your go-to solution for such cases. This statement returns a list of all tables in the current database, making it a powerful tool for any database administrator or developer working with MariaDB.

the table is set with yellow flowers and place settings
the table is set with yellow flowers and place settings

Before delving into its intricacies, let's briefly understand why you might need to use MariaDB's SHOW TABLES. Database tables are where data is stored. Knowing what tables exist helps in understanding the structure of the database, identifying relationships between data, and planning schema changes. It also aids in debugging and identifying potential data integrity issues.

the table is set with flowers and grapes on it, candles are lit in the background
the table is set with flowers and grapes on it, candles are lit in the background

Understanding MariaDB's SHOW TABLES

MariaDB's SHOW TABLES is a simple yet powerful statement. It doesn't take any parameters, making it user-friendly and accessible. It displays the table names in a result set, with each table name appearing on a new row.

the table is set with white flowers and place settings for guests to sit down at
the table is set with white flowers and place settings for guests to sit down at

The output format is straightforward. Each table name is enclosed in quotes, making it easy to identify and parse programmatically if needed.

Syntax and Basic Usage

Exhibition Booth – Trade Show Display – CMISA | WorkBoat Show
Exhibition Booth – Trade Show Display – CMISA | WorkBoat Show

The syntax of the SHOW TABLES statement is basic and intuitive. It follows the format:

```sql SHOW TABLES; ```

Simply typing this command into your MariaDB client and executing it will display all table names in the current database.

Basic Output and Interpretation

How to Create the Perfect Trade Show Table
How to Create the Perfect Trade Show Table

Suppose you have a database named 'mydatabase' with tables 'employees', 'departments', and 'salaries'. When you run the SHOW TABLES statement, the output might look like this:

```sql Tables in mydatabase +----------------+ | Tables_in_mydatabase | +----------------+ | employees | | departments | | salaries | +----------------+ ```

Each row represents a table in the 'mydatabase' schema.

SHOW TABLES with Wildcards

a long table set up for a formal dinner in front of a large white building
a long table set up for a formal dinner in front of a large white building

MariaDB's SHOW TABLES statement supports wildcard characters, allowing for more flexible querying. This feature helps when you want to list only tables that match a certain pattern.

You can use the wildcard character '%' to replace any number of characters, or '_' to replace a single character. For instance, '%emp%' will match any table name containing 'emp' anywhere in the name.

a long table filled with lots of food on top of plates and glasses next to each other
a long table filled with lots of food on top of plates and glasses next to each other
the table is made out of wood and has two oval shaped tables on each side
the table is made out of wood and has two oval shaped tables on each side
a white table with flowers on it in front of a building
a white table with flowers on it in front of a building
22 Excellent Colorful Ideas For Your Banquet Hall Wedding Decor - Elegantweddinginvites.com Blog
22 Excellent Colorful Ideas For Your Banquet Hall Wedding Decor - Elegantweddinginvites.com Blog
the stage is set up for an event with pictures on it and lights in the background
the stage is set up for an event with pictures on it and lights in the background
MySQL ALTER TABLE Statement - Scientech Easy
MySQL ALTER TABLE Statement - Scientech Easy
wedding
wedding
an empty banquet hall with tables and chairs
an empty banquet hall with tables and chairs
an entrance to a building decorated with flowers and greenery
an entrance to a building decorated with flowers and greenery

Using Percentage Wildcards

To list all tables containing 'emp' in their name, you can use:

```sql SHOW TABLES LIKE '%emp%'; ```

The output could include tables like 'employees', 'empo_bonuses', or 'employee_multipliers'.

Using Underscore Wildcards

Similarly, '_emp_' will match any table name that starts with 'emp' followed by any character, like 'empolyee_data'.

Using wildcards in SHOW TABLES can greatly enhance your query precision, but remember, they should be used judiciously to avoid excessive processing time and potential security risks.

Practical Applications of SHOW TABLES

From simple listing to complex data analysis, SHOW TABLES has numerous practical uses.

Schema Analysis

Understanding your database schema involves knowing what tables exist and how they relate to each other. SHOW TABLES is a fundamental starting point for this analysis. Once you know your table names, you can explore primary keys, foreign keys, and other relationships.

Debugging and Data Integrity

If you're experiencing data silos or data duplication issues, a first step could be to list all tables to identify any unexpected schemas or unwanted data accumulation.

Auto-generated Schemas

Many applications auto-generate schemas based on user data. In such cases, SHOW TABLES can serve as a quick overview of the database structure and changes over time.

In the dynamic world of databases, staying informed about your schema is crucial. MariaDB's SHOW TABLES statement is an indispensable tool for this. From routine tasks to complex analyses, it helps ensure your data stays organized and accessible.