1. Add a default comment when creating a table
Create table groups (gid int primary key AUTO_INCREMENT COMMENT 'Set primary key auto-incrementing', gname VARCHAR (200) COMMENT 'column COMMENT ',) COMMENT = 'table COMMENT'
2. Modify the created table comment
Alter table groups COMMENT 'alter TABLE groups modify column gname VARCHAR (100) comment' modify column comment'
3. View table comments (I like to use the second one)
SHOW CREATE TABLE communication_group
Or
SELECT table_name, table_comment FROM information_schema.tables WHERE table_schema = 'db 'AND table_name = 'table name group'
4. View column comments (I like to use the first one)
Show full columns from groups -- you can search for the information of a name or column of a data type by condition: for example, show full columns from tableName where field = 'add _ time' or type like '% date %' -- View COLUMNS whose column name is add_time OR whose TYPE is date in the tableName table
Or
SELECT column_name, column_comment FROM information_schema.columns WHERE table_schema ='db' AND table_name = 'groups'