MySQL 数据结构常用命令
查询数据表结构
select TABLE_NAME, TABLE_TYPE, ENGINE, DATA_LENGTH, CREATE_TIME, TABLE_COLLATION, TABLE_COMMENT
from information_schema.tables where TABLE_SCHEMA=:database AND TABLE_TYPE='BASE TABLE' order by TABLE_NAME
查询数据字段
select COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, COLUMN_TYPE, IS_NULLABLE, EXTRA, DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, COLUMN_KEY, COLUMN_COMMENT from
information_schema.columns WHERE TABLE_SCHEMA=:database AND TABLE_NAME=:table order by ORDINAL_POSITION