Find tables with names that contain a specific prefix in MySQL database

The queries below find tables whose names start with a specific prefix, e.g. tables with names starting with 'cu'.

Do you ever feel like him?

Don't worry, we just might have a solution...

Find out what it is

Query

select table_schema as database_name,
    table_name
from information_schema.tables
where table_type = 'BASE TABLE'
    and table_name like 'cu%'
order by table_schema,
     table_name;

Columns

  • database_name - name of the database (schema) where the table was found
  • table_name - name of the table found

Rows

  • One row: represents a table
  • Scope of rows: all found tables
  • Ordered by: database (schema) name, table name

Sample results

Create beautiful and useful documentation of your MySQL

Generate convenient documentation of your databases in minutes and share it with your team. Capture and preserve tribal knowledge in shared repository.

See how it works