Find number of tables in MariaDB database

The query below returns the total number of tables per database (schema).


select table_schema as database_name,
    count(*) as tables
from information_schema.tables
where table_type = 'BASE TABLE'
      and table_schema not in ('information_schema', 'sys',
                               'performance_schema', 'mysql')
group by table_schema
order by table_schema;


  • database_name - name of the database (schema)
  • tables - number of tables in the database (schema)


  • One row: represents a database (schema)
  • Scope of rows: all databases (schemas)
  • Ordered by database (schema) name

Sample results

There are no comments. Click here to write the first comment.