SELECTTABLE_CATALOG,TABLE_SCHEMA as 数据库名,TABLE_NAME as 表名,COLUMN_NAME as 字段名,ORDINAL_POSITION as 字段位置,COLUMN_DEFAULT as 字段默认值,IS_NULLABLE 是否允许空值,DATA_TYPE as 数据类型,CHARACTER_MAXIMUM_LENGTH as 以字符为单位的最大长度,CHARACTER_OCTET_LENGTH as 以字节为单位的最大长度,NUMERIC_PRECISION as 数值类型的长度,NUMERIC_SCALE as 小数点精度,DATETIME_PRECISION as 回的日期时间值的精度,CHARACTER_SET_NAME as 编码方式,COLLATION_NAME as 校对集,COLUMN_TYPE as 字段类型,COLUMN_KEY as 键,EXTRA as 额外的信息例如自动递增在这里显示,PRIVILEGES as 权限,COLUMN_COMMENT as 字段注释,GENERATION_EXPRESSIONFROM information_schema. COLUMNSWHERE TABLE_SCHEMA = 'Testplatform'
SELECT
TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENTFROM information_schema. COLUMNSWHERE TABLE_SCHEMA = '数据库名称'
SELECT
TABLE_SCHEMA, TABLE_NAME AS '表名', COLUMN_NAME AS '字段名', COLUMN_TYPE AS '数据类型', IS_NULLABLE AS '允许为空', EXTRA AS '额外信息', COLUMN_COMMENT AS '字段说明' FROM information_schema.`COLUMNS` WHERE TABLE_SCHEMA = 'Testplatform'