MySQL build table, look up table, look up the table structure

Source: Internet
Author: User

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

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.