Enter the database:
1 mysql> use sunshine_blog;
Output:2Database changed
Check the database table:
1Mysql>Show tables;
Output:2 +-------------------------+3 |Tables_in_sunshine_blog|4 +-------------------------+5 |Test|6 | User |7 +-------------------------+8 2Rowsinch Set(0.00Sec
Build table: Auto_increment automatically increment, not null non-NULL, primary key (field) primary key;
1Mysql> Create TableTest (2 -Namevarchar( the),3 -Emailvarchar( -),4 -Phone_numberint,5 -Idint not NULLAuto_increment,6 - Primary Key(ID));
Output:7Query OK,0Rows Affected (0.16Sec
Display field, field Information command:
1Mysql>Show Columns fromtest;
Output:2 +--------------+-------------+------+-----+---------+----------------+3 |Field|Type| Null | Key | Default |Extra|4 +--------------+-------------+------+-----+---------+----------------+5 |Name| varchar( the)|YES| | NULL | |6 |Email| varchar( -)|YES| | NULL | |7 |Phone_number| int( One)|YES| | NULL | |8 |Id| int( One)|NO|Pri| NULL |Auto_increment|9 +--------------+-------------+------+-----+---------+----------------+Ten 4Rowsinch Set(0.01Sec
MySQL build table, look up table, look up the table structure