在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);
有什么想法吗?
答案 0 :(得分:9)
与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'