Find tables with names that contain a specific suffix in MariaDB database

The query below finds tables whose names end with a specific suffix, e.g. table names ending with 'mer'.

Query

select table_schema as database_name,
    table_name
from information_schema.tables
where table_type = 'BASE TABLE'
    and table_name like '%mer'
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 one table found
  • Scope of rows: all found tables
  • Ordered by: database (schema) name, table name

Sample results