在MySQL中使用SELECT语句获取表名?
要使用SELECT语句获取表名,请使用“information_schema.tables”。让我们看一个示例,其中我们有一个包含3个表的数据库。借助SELECT语句获取所有表名的语法。
SELECT Table_name as TablesName from information_schema.tables where table_schema = 'yourDatabaseName';
使用数据库“test”,并使用SELECT来应用上述语法以获取表名
mysql> use test; Database changed mysql> SELECT Table_name as TablesName from information_schema.tables where table_schema = 'test';
输出三个表的名称。
+--------------------+ | TablesName | +--------------------+ | destination | | myisamtoinnodbdemo | | originaltable | +--------------------+ 3 rows in set (0.00 sec)
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短