Objective
No more nonsense, just go straight on.
1. View the table structure Basic statement describe
The DESCRIBE/DESC statement can view table field information, including: Lot Name, field data type, whether it is a primary key, whether there are default values, and so on. The syntax rules are as follows:
Describe table name, or desc table name;
Example: Use describe and desc to view the table structure of table TB_EMP8 and table TB_EMP7, respectively.
To view the TB_DEPT1 table structure, SQL statements are as follows:
650) this.width=650; "Width=" 475 "height=" 324 "title=" 2017-10-14_165726.png "style=" WIDTH:472PX;HEIGHT:309PX; "alt=" Wkiol1nhzwwhabktaaag5bg0md0880.png "src=" Https://s5.51cto.com/wyfs02/M01/A7/26/wKioL1nhzwWhabkTAAAg5bG0MD0880.png "/>
Among them, the meanings of each field are explained separately as follows:
Null: Indicates whether the column can store null refers to
Key: Indicates whether the column is indexed. The PRI indicates that the column is part of the primary key of the table; Uni indicates that the column is part of a unique index, and Null indicates that a given value in the column is allowed to occur more than once.
Default: Indicates whether the column has a defaults value. If so, what is the value.
Extra: Represents additional information that can be obtained in relation to a given column, such as Auto_increment.
View table Detail Structure Statement show CREATE TABLE
The show CREATE TABLE statement can be used to display the CREATE TABLE statement when creating tables with the syntax in the following format:
Show CREATE table < table name >
Tips! Using the show CREATE TABLE statement, you can view not only detailed statements at table creation time, but also the storage engine and character encoding.
Example: Using show create table to view TB_EMP7 details, the SQL statement is as follows:
650) this.width=650; "Width=" 501 "height=" 179 "title=" 2017-10-14_171229.png "style=" width:516px;height:211px; "src=" Https://s2.51cto.com/wyfs02/M02/08/72/wKiom1nh1OrzcxGmAAAXrEWCjRY935.png-wh_500x0-wm_3-wmp_4-s_825132547.png " alt= "Wkiom1nh1orzcxgmaaaxrewcjry935.png-wh_50"/>
Summarize! Database needs more practice and more practical thinking!
This article from "Li Shilong" blog, declined reprint!
mysql5.7 View the describe of the basic statement of the table structure