SELECT
COLUMN_NAME 列名,
COLUMN_TYPE 数据类型,
DATA_TYPE 字段类型,
CHARACTER_MAXIMUM_LENGTH 长度,
IS_NULLABLE 是否为空,
COLUMN_DEFAULT 默认值,
COLUMN_COMMENT 备注
FROM
INFORMATION_SCHEMA.COLUMNS
where
table_schema ='dev'
SELECT
table_name 表名,
table_comment 表说明
FROM
information_schema.TABLES
WHERE table_schema = '数据库名'
ORDER BY table_name
SELECT
a.table_name 表名,
a.table_comment 表说明,
b.COLUMN_NAME 字段名,
b.column_comment 字段说明,
b.column_type 字段类型,
b.column_key 约束
FROM
information_schema.TABLES a
LEFT JOIN information_schema.COLUMNS b
ON a.table_name = b.TABLE_NAME
WHERE a.table_schema = '数据库名'
ORDER BY a.table_name
select
COLUMN_NAME 字段名,
column_comment 字段说明,
column_type 字段类型,
column_key 约束 from information_schema.columns
where table_schema = '库名'
and table_name = '表名' ;
网友评论