开发者

How to do "show tables as col" alike stuff?

开发者 https://www.devze.com 2023-03-25 03:28 出处:网络
mysql> show tables; +----------------+ Tables_in_test | +----------------+ t| t2| test| +----------------+
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

精彩评论

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

关注公众号