查询表字段信息sql

查询表字段信息sql

SELECT 
  COLUMN_NAME 列名, 
data_type 数据类型,
  SUBSTR(COLUMN_TYPE,INSTR(COLUMN_TYPE,'(')+1,INSTR(COLUMN_TYPE,')') - INSTR(COLUMN_TYPE,'(')-1) 字段长度, 
    if(IS_NULLABLE='YES','否','是') 是否必填,
  COLUMN_COMMENT 备注
FROM 
 INFORMATION_SCHEMA.COLUMNS 
where 
TABLE_SCHEMA ='db_wechat'    -- 数据库名称 
AND 
`TABLE_NAME`  = 't_user' ;   -- 表名
# mysql 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×