MySQL表结构查询
2023/12/31小于 1 分钟
一、Mysql表结构查询
SELECT
column_name AS '名',
column_comment AS '备注(中文名)',
column_default AS '默认值',
-- column_type AS '类型',
data_type AS '类型',
character_maximum_length AS '长度',
-- numeric_precision AS '精度',
numeric_scale AS '小数位数',
IF ( is_nullable = 'NO', 'N', '' ) AS '能否为空',
IF ( extra = 'auto_increment', 'Y', '' ) AS '是否自增',
IF ( column_key = 'PRI', 'Y', '' ) AS '是否主键'
FROM
information_schema.columns
WHERE
table_schema = ''
AND table_name = ''
-- 导出到桌面的Excel表格
-- INTO OUTFILE 'D:/test.xls'