如何做“将表格显示为 col”之类的东西?

R__*_*R__ 2 mysql

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;
Run Code Online (Sandbox Code Playgroud)

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

有没有办法做到这一点?

won*_*nk0 5

使用 information_schema:

SELECT 
 table_name AS c 
FROM 
 information_schema.tables
WHERE 
 table_schema = DATABASE()
Run Code Online (Sandbox Code Playgroud)