SELECT
    UPPER(column_name) AS '字段名称',
    column_comment AS '字段描述',
    UPPER(column_type) AS '字段类型',
    IF(column_key='PRI','TRUE','FALSE') AS '主键唯一',
    IF(IS_NULLABLE='NO','TRUE','FALSE') AS '非空'
FROM
    information_schema. COLUMNS
WHERE
    TABLE_SCHEMA = '数据库名称'
AND table_name = '表名';

Logo

更多推荐