admin 管理员组

文章数量: 886993

快速理清数据库中表之间的关系

获得指定的库对应的所有表名和列名以及他们的注释

SELECT b.table_name AS "表名称", b.Table_comment AS "表注释", a.column_name AS "字段名称",a.data_type AS '数据类型', a.column_comment AS "字段注释" 
FROM (SELECT column_name, Table_name, column_comment, table_schema,data_typeFROM information_schema.columnsWHERE table_schema = "这里输入要查询的库的名称"
) aLEFT JOIN (SELECT table_name, Table_comment, table_schemaFROM information_schema.tables) bON a.Table_name = b.table_nameAND a.table_schema = b.table_schema

 

本文标签: 快速理清数据库中表之间的关系