建表+注释
CREATE TABLE student(
id INT PRIMARY KEY AUTO_INCREMENT COMMENT '学号',
name VARCHAR(200) COMMENT '姓名',
age int COMMENT '年龄'
) COMMENT='学生信息'
修改注释
修改表注释-ALTER TABLE student COMMENT '学生表';
修改列注释-ALTER TABLE student MODIFY COLUMN name VARCHAR(100) COMMENT '姓名';
SELECT table_name,table_comment FROM information_schema.tables WHERE table_schema = '所在的db' AND table_name ='表名groups'
SHOW FULL COLUMNS FROM groups
-- 这个可以按条件的去搜索某名字或某数据类型的列的信息:例如
SHOW FULL COLUMNS FROM tableName WHERE FIELD = 'add_time' OR TYPE LIKE '%date%' -- 查看tableName表中列名是add_time的或类型是date的列
SELECT column_name, column_comment FROM information_schema.columns WHERE table_schema ='db' AND table_name = 'groups'
SHOW CREATE TABLE communication_group