mysql查询列定义,是否自增等
时间:2021-07-01 10:21:17
帮助过:4人阅读
ORDINAL_POSITION AS Colorder,
Column_Name AS ColumnName,
data_type AS TypeName,
COLUMN_COMMENT AS DeText,
(
CASE
WHEN data_type
= ‘float‘
OR data_type
= ‘double‘
OR data_type
= ‘decimal‘ THEN
NUMERIC_PRECISION
ELSE
CHARACTER_MAXIMUM_LENGTH
END
) AS length,
NUMERIC_SCALE AS Scale,
(
CASE
WHEN EXTRA
= ‘auto_increment‘ THEN
1
ELSE
0
END
) AS IsIdentity,
(
CASE
WHEN COLUMN_KEY
= ‘PRI‘ THEN
1
ELSE
0
END
) AS IsPK,
(
CASE
WHEN IS_NULLABLE
= ‘NO‘ THEN
0
ELSE
1
END
) AS CanNull,
extra,
COLUMN_DEFAULT AS DefaultVal
FROM
information_schema. COLUMNS
mysql查询列定义,是否自增等
标签:case sele auto imu osi double rom rac identity