Previously, due to the requirement of Project customers to see the table comment and field comment in the table, it was a bit confusing at the beginning. I have not done it before, but it is still a step by step.
Test: [A table already exists in the database, which is described here]
1. Create a table
Mysql> create table stu1 (-> id int not null auto_increment primary key comment "a"->)-> comment = "remark 1"; Query OK, 0 rows affected (0.11 sec) mysql> create table stu2 (-> id int not null auto_increment primary key comment "B"->)-> comment = "NOTE 2 "; query OK, 0 rows affected (0.07 sec) mysql> create table stu3 (-> id int not null auto_increment primary key comment "C"->) -> comment = "NOTE 3"; Query OK, 0 rows affected (0.11 sec) mysql> show tables; + ---------------- + | Tables_in_test | + ---------------- + | stu1 | stu2 | stu3 | test_table | + ---------------- + 4 rows in set (0.01 sec)
2. View All Table comments in the database
Essentials: select table_comment from information_schema.tables where table_schema = "Database Name ";
Mysql> select table_comment from information_schema.tables where table_schema = "test "; + --------------- + | table_comment | + --------------- + | Note 1 | Note 2 | Note 3 | test table | + --------------- + 4 rows in set (0.01 sec)
3. View All field comments in the data table
Essentials: select column_comment from Information_schema.columns where table_name = "table name ";
Mysql> select column_comment as "field comment" from Information_schema.columns where table_name = "stu1 "; + ---------- + | field comment | + ---------- + | a | + ---------- + 1 row in set (0.04 sec) mysql>
Summary:
The implementation of these statements is conducive to improving the user experience and achieving the objective of software dummies