-- DM 达梦SELECT
t.COLUMN_NAME AS 列名,
c.COMMENTS AS 中文描述,
CONCAT(t.DATA_TYPE,'(', t.DATA_LENGTH,')')AS 数据类型,
t.DATA_TYPE AS 字段类型,CASE t.NULLABLE WHEN'N'THEN'否'ELSE'是'ENDAS 是否为空,
t.DATA_DEFAULT AS 默认值
FROM
user_tab_columns t
LEFTJOIN user_col_comments c
ON
t.table_name = c.table_name
AND t.COLUMN_NAME = c.COLUMN_NAME
WHERE
t.table_name ='TB_NAME'-- 表名GROUPBY
t.COLUMN_NAME
3、Oracle 数据库
-- oracleSELECT
t.COLUMN_NAME 列名,
t.DATA_TYPE 数据类型,
t.DATA_LENGTH 长度,
t.NULLABLE 是否为空,
c.comments 注释
FROM
user_tab_columns t
INNERJOIN user_col_comments c
ON
t.TABLE_NAME = c.table_name
AND t.COLUMN_NAME = c.column_name
WHERE
t.Table_Name ='TB_NAME'-- 表名ORDERBY
t.column_name