SELECT TABLE_NAME ‘表名‘,TABLE_SCHEMA ‘数据库名‘,ORDINAL_POSITION ‘顺序‘,COLUMN_NAME ‘字段‘,DATA_TYPE ‘类型‘
,CHARACTER_OCTET_LENGTH ‘字节长‘,if(COLUMN_KEY=‘PRI‘,"√","") ‘主键‘,if(EXTRA=‘auto_increment‘,"√","") ‘自增长‘
,if(IS_NULLABLE=‘YES‘,"√","") ‘空‘,CHARACTER_SET_NAME ‘编码‘,COLUMN_DEFAULT ‘默认值‘,COLUMN_COMMENT ‘说明‘
FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=‘dzbbs‘ and COLUMN_NAME=‘username‘
where条件 【WHERE TABLE_SCHEMA=‘dzbbsdb‘ and COLUMN_NAME=‘username‘】
是查询数据库名为dzbbsdb的数据库中所有包含username列名的表信息。