Alex Rivera | Logout

Alias to Show Tables MySQL Result

Asked 2012-07-07T20:26:43.220
9

When executing SHOW TABLES FROM your_db_name_here inside MySQL, the result has Tables_in_{your_db_name_here} as its indexes. I'd like to change that, like this:

SHOW TABLES as _tables FROM mydb;

or something like

SELECT Tables_in_mydb AS _tables FROM (SHOW TABLES FROM mydb);

Any ideas?

Edit
Report

1 Answer

13

It's usually easier to interact with the INFORMATION_SCHEMA database:

http://dev.mysql.com/doc/refman/5.0/en/tables-table.html

Example:

SELECT TABLE_NAME AS _tables 
FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_SCHEMA = 'mydb'
answered 2012-07-07T20:36:15.047

Your Answer