Development Log: Add comments for tables and columns when creating a table in mySQL, and view comments for tables and columns.
Development Log: add notes for tables and columns when creating a mySQL table, and view the notes for tables and columns _ MySQL
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'
The above is the development log: mySQL adds notes for tables and columns when creating tables, as well as views the content of note_mysql for tables and columns. For more information, see PHP Chinese network (www.php1.cn )!