如何“将表格显示为列"一样的东西? [英] How to do "show tables as col" alike stuff?

查看:42
本文介绍了如何“将表格显示为列"一样的东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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;

我想恢复名为 c 的列中的结果,但是如您所见,这是语法错误...

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 at all?

推荐答案

使用 information_schema:

Use the information_schema:

SELECT 
 table_name AS c 
FROM 
 information_schema.tables
WHERE 
 table_schema = DATABASE()

这篇关于如何“将表格显示为列"一样的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆