Database Physical model:650) this.width=650; "Src=" http://s1.51cto.com/wyfs02/M02/75/BB/ Wkiol1zbl6uhw9tmaaden64jyds964.png "title=" physical model. png "alt=" Wkiol1zbl6uhw9tmaaden64jyds964.png "/>
Database sql:
Create table consignee_management ( consignee_id int not null auto_increment, user_id int, consignee_name varchar (), consignee_address varchar ( (+), consignee_code varchar (Ten), Consignee_phone varchar (one), primary key ( consignee_id)); Create table goods_info ( goods_id int not null auto_increment, Goods_name varchar (, ) goods_price double, goods_url varchar (, goods_desc ) varchar (, goods_state ) varchar comment ' 1 shelves 2 bottom shelf ', primary key (goods_id) create table order_detail ( order_ detail_id int not null auto_increment, order_id int, goods_id int, orde_number int, order_price double, primary key (order_detail_id));create table Order_management ( order_id int not null auto_increment, user_id int, consignee_id int, order_time datetime, order_total double, order_state varchar (, primary key ) (order_id); Create table user_info ( user_id int not null auto_increment, user_name varchar (, user_sex ) varchar (Ten), user_phone varchar (one), user_pw varchar (, user_type ) varchar (5) comment ' 1 general user 2 Administrator ', primary key (user_id)); alter table consignee_management add constraint FK_Reference_1 foreign key (user_id) references user_info (user_id) on delete restrict on update restrict;alter table order_detail add constraint fk_reference_4 foreign key (order_id) references order_management (order_id) on delete restrict on update Restrict;alter table order_detail add constraint fk_reference_5 foreign key (goods_id) references goods_info (goods_id) on delete restrict on update restrict;alter table order_management add constraint fk_reference_2 foreign key (user_id) references user_info (user_id) on delete restrict on update restrict; Alter table order_management add constraint fk_reference_3 foreign key (consignee_id) references consignee_management (consignee_ ID) on delete restrict on update restrict;
This article is from the "Lao Niu Java" blog, please be sure to keep this source http://liuyj.blog.51cto.com/2340749/1711450
Database design (PMD) of real-maven+ssh online mall Project