Mysql Table View comments or comments field

Mysql Table View or comment fields Comment
View all comments table

The SELECT
table_name table,
table_comment table shows
the FROM
information_schema.tables
the WHERE
TABLE_SCHEMA = 'database name'
the ORDER BY
table_name

Notes query all tables and fields

The SELECT
a.table_name table,
a.table_comment table shows,
b.COLUMN_NAME field names,
b.column_comment field descriptions,
b.column_type field type,
b.column_key constraint
the FROM
INFORMATION_SCHEMA. TABLES A
the LEFT INFORMATION_SCHEMA the JOIN. A.table_name the COLUMNS the ON B b.TABLE_NAME =
the WHERE
a.table_schema = 'database name'
the ORDER BY
a.table_name

Notes query all the fields in a table

SELECT
COLUMN_NAME field names,
column_comment field descriptions,
column_type field type,
column_key from information_schema.columns constraint from
WHERE TABLE_SCHEMA = 'database name'
and table_name = 'table';

or

show full columns from 表名;

View table generated DDL

Note that the table name without single quotation marks

show create table 表名;

New tables and add tables and fields Comment

Table T_USER Create (
ID the INT (. 19) Primary Key AUTO_INCREMENT Comment 'master key',
NAME VARCHAR (300) Comment 'name',
CREATE_TIME DATE Comment 'Created'
) Comment = 'user information table';

Note modifying a table / field

Modify Table Notes

alter table t_user comment = 'table annotation information (user information table) modified';

Modify the comment field

alter table t_user modify column id int comment ‘主键ID’;

Jane books

Guess you like

Origin blog.csdn.net/weixin_42829146/article/details/89239630