开发者

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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜