Extract table names from Database

BigBaz's profile image BigBaz posted 4 years ago in Running SQL scripts Permalink

Hi, From MSSQL if I want to get a list of all my table names I use:

SELECT table_name FROM INFORMATION_SCHEMA.TABLES where table_type = 'BASE TABLE' ORDER BY table_name ASC

However, doing this on a Maria databse not only gives me my table names but all 'event', 'file' and a host of other tables that I'm not interested in.

Is there a better SELECT statement for getting just my owned table names?

ansgar's profile image ansgar posted 4 years ago Permalink

You can use the SHOW command on MySQL and/or MariaDB:

SHOW TABLES;
SHOW TABLES FROM mydb;
SHOW TABLE STATUS FROM mydb;
BigBaz's profile image BigBaz posted 4 years ago Permalink

Many thanks. Perfect!

Please login to leave a reply, or register at first.