mysql建表語句

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)
);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值