是否有可能从show tables
MySQL中选择?
SELECT * FROM (SHOW TABLES) AS `my_tables`
沿着这些方向的东西,虽然以上不起作用(至少在5.0.51a).
我想你想要的 SELECT * FROM INFORMATION_SCHEMA.TABLES
请参见http://dev.mysql.com/doc/refman/5.0/en/tables-table.html
不是我所知道的,除非你选择INFORMATION_SCHEMA
,正如其他人所提到的那样.
但是,该SHOW
命令非常灵活,例如:
SHOW tables like '%s%'
数数:
SELECT COUNT(*) as total FROM (SELECT TABLE_NAME as tab, TABLES.* FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='database_name' GROUP BY tab) tables;
要列出:
SELECT TABLE_NAME as table, TABLES.* FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='database_name' GROUP BY table;