MySQL数据库获取数据库中所有表名称

  1. 1.获取数据库中单个数据库中所有表名称。

固定格式:

SELECT 

  table_name 

FROM

  information_schema.tables 

WHERE table_schema = 'gz_risk'   //这里的名称为需要导出数据库的名称,其他的为固定格式

  AND table_type = 'base table' 

  1. 2.获取数据库中所有表的名称:

这里获取得到的是整个数据库中的所有表:

SELECT table_name FROM information_schema.TABLES 

  1. 3.获取mysql数据库中单个数据库中的所有表名称以及中文名称

  
SELECT table_name, table_type, TABLE_COMMENT,

  FROM information_schema.tables

  WHERE table_schema = 'gz_risk' //当前数据库名称

  ORDER BY table_name DESC;

猜你喜欢

转载自blog.csdn.net/Tank_666/article/details/90257925