How to get the list of tables in default MySQL database?
Answers
e query below lists tables in current or provided databases .To list tables all user databases use this query.
Query
Current database
select table_schema as database_name,
table_name
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema = database()
order by database_name, table_name;
Specified database
select table_schema as database_name,
table_name
from information_schema.tables
where table_type = 'BASE TABLE'
and table_schema = 'database_name' -- enter your database name here
order by database_name, table_name;
Columns
table_schema - database (schema) name
table_name - table name
Rows
One row: represents one table in a database
Scope of rows: all tables in current/selected database
Ordered by: table name
Sample results