1 查看表的创建语句 2 show create table table_name; (默认网格视图,但用text view 视图去看比较方便) 3 4 查询表中列名和注释 5 show full columns from auth_use 6 7 8 /* 查询数据库 ‘mammothcode’ 所有表注释 */ 9 SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE table_schema='mammothcode'; 10 11 /* 查询数据库 ‘mammothcode’ 下表 ‘t_adminuser’ 所有字段注释 */ 12 SELECT COLUMN_NAME,column_comment FROM INFORMATION_SCHEMA.Columns WHERE table_name='t_adminuser' AND table_schema='mammothcode' 13 14 一次性查询表注释-列名-列注释 15 SELECT t.TABLE_NAME,t.TABLE_COMMENT,c.COLUMN_NAME,c.COLUMN_TYPE,c.COLUMN_COMMENT FROM information_schema.TABLES t, 16 INFORMATION_SCHEMA.Columns c WHERE c.TABLE_NAME=t.TABLE_NAME AND t.TABLE_NAME='TableName'; 17 18 查询表中下一个自增主键的值 19 SELECT MAX(AUTO_INCREMENT) FROM information_schema.`TABLES` WHERE table_name = 'cdm_t_res_hard' ;