Example of creating a MySQL table

Source: Internet
Author: User

Create Table midprojects_producttype (
Id int (10) Not null auto_increment primary key,
Name varchar (50 ),
Description varchar (50 ),
Orderid int
);

Create Table location_desc (
Id int (10) Not null primary key,
Location_id int not null,
Location_name varchar (50) not null,
Location_desc varchar (50)
);

Create Table midprojects_p_location (
Id int (10) Not null auto_increment primary key,
Projectname varchar (50) not null,
Location_id int,
Foreign key (location_id) References location_desc (ID)
);

Create Table midprojects_p_detail (
Id int (10) Not null auto_increment primary key,
Producttype_id int not null,
P_location_id int (10) Not null,
Bu_id int (10) Not null,
Process_type_id int (10) Not null,
P_stage_id int (10) Not null,
Foreign key (producttype_id) References midprojects_p_producttype (ID ),
Foreign key (p_location_id) References midprojects_p_location (ID ),
Foreign key (bu_id) References midprojects_p_bu (ID ),
Foreign key (process_type_id) References midprojects_p_process_type (ID ),
Foreign key (p_stage_id) References midprojects_p_stage (ID)
);
Create Table stage_desc (
Id int (10) Not null auto_increment primary key,
Stage_name varchar (50) not null,
Stage_desc varchar (50)
);

Create Table midprojects_p_stage (
Id int (10) Not null auto_increment primary key,
Stage_id int (10) Not null,
Updatetime date not null,
Enddatetime date not null,
Foreign key (stage_id) References stage_desc (ID)
);

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.