Create a table in MySQL

Source: Internet
Author: User

I. References

Http://dev.mysql.com/doc/refman/5.1/zh/sql-syntax.html#create-table

Http://www.cnblogs.com/yunf/archive/2011/04/20/2022193.html

Http://www.blogjava.net/coderdream/archive/2007/08/17/137642.html

Ii. Create a table

 
Create [temporary] Table [if not exists] tbl_name [(create_definition,...)] [table_options] [select_statement] Or: Create [temporary] Table [if not exists] tbl_name [(] Like old_tbl_name [)];

For example:

 
Create Table players (playerno integer not null primary key, name char (15) not null, Brith date, sex char (1) not null check (sex in ('M ', 'F'), joined smallint not null check (joined> 1969), Stree char (50), phoneno char (13) not null)
 
Create Table T2 like players # their table structures are the same

 

 1   Create   Table  Shop (  2 ID Int   Not   Null   Primary   Key  Auto_increment,  3 Name Varchar ( 10 ) Not  Null  ,  4 Country Varchar ( 30 ) Not   Null  5 ) Engine = InnoDB Default Charset = Utf8 auto_increment =  1 

 

Iii. Advanced

To be continued ,,,,

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.