7

在 MySQL 中执行 SHOW TABLES FROM your_db_name_here时,结果以Tables_in_{your_db_name_here}作为其索引。我想改变它,像这样:

SHOW TABLES as _tables FROM mydb;

或类似的东西

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

有任何想法吗?

4

1 回答 1

12

INFORMATION_SCHEMA与数据库交互通常更容易:

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

例子:

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