How to do "show tables as col" alike stuff?
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| t |
| t2 |
| test |
+----------------+
3 rows in set (0.00 sec)
mysql> show tables as c;
ERROR 1064 (42000): You have an error in your SQL syntax;
I want to restore the result in column named c
,but as you see,it's syntax error...
Is there a way to do it 开发者_如何学Cat all?
Use the information_schema:
SELECT
table_name AS c
FROM
information_schema.tables
WHERE
table_schema = DATABASE()
精彩评论