- sql生成
SELECT
COLUMN_NAME 名称,
COLUMN_TYPE 数据类型,
IF(IS_NULLABLE='NO','是','否') AS '是否允许为空',
COLUMN_DEFAULT '默认值',
COLUMN_COMMENT 注释
FROM
INFORMATION_SCHEMA.COLUMNS
where
table_schema ='db-name'
AND
table_name = 'table-name'db-name:库名
table-name:表名
SELECT
COLUMN_NAME 名称,
COLUMN_TYPE 数据类型,
IF(IS_NULLABLE='NO','是','否') AS '是否允许为空',
COLUMN_DEFAULT '默认值',
COLUMN_COMMENT 注释
FROM
INFORMATION_SCHEMA.COLUMNS
where
table_schema ='db-name'
AND
table_name = 'table-name'db-name:库名
table-name:表名