MySQL table comments and field comments

Source: Internet
Author: User

1 Write comments when creating a table

CREATE TABLE Test1

(

field_name int comment ' field comment '

) comment= ' table notes ';

2 Modifying a table's annotations

ALTER TABLE TEST1 comment ' modified table comment ';

3 Modifying a comment for a field

ALTER TABLE test1 Modify column field_name int comment ' modified field comment ';

--Note: The Field name and field type are written as follows.

4 Ways to view table annotations

--in the generated SQL statement

Show CREATE table test1;

--in the table of meta-data

Use INFORMATION_SCHEMA;

SELECT * from TABLES where table_schema= ' my_db ' and table_name= ' test1 ' \g

5 ways to view field annotations

--show

Show full columns from test1;

--in the table of meta-data

SELECT * from COLUMNS where table_schema= ' my_db ' and table_name= ' test1 ' \g

MySQL table comments and field comments

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.