03(maven+SSH)网上商城项目实战之数据库设计(PMD)

数据库物理模型:

sql代码:

create table consignee_management
(
   consignee_id         int not null auto_increment,
   user_id              int,
   consignee_name       varchar(50),
   consignee_address    varchar(1000),
   consignee_code       varchar(10),
   consignee_phone      varchar(11),
   primary key (consignee_id)
);
create table goods_info
(
   goods_id             int not null auto_increment,
   goods_name           varchar(200),
   goods_price          double,
   goods_url            varchar(1000),
   goods_desc           varchar(2000),
   goods_state          varchar(10) comment '1 上架  2 下架',
   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(10),
   primary key (order_id)
);
create table user_info
(
   user_id              int not null auto_increment,
   user_name            varchar(50),
   user_sex             varchar(10),
   user_phone           varchar(11),
   user_pw              varchar(100),
   user_type            varchar(5) comment '1 普通用户  2 管理员',
   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;


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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值