02(maven+SSH)网上商城项目实战之数据库设计(PMD)
2015-11-10 18:29
639 查看
数据库物理模型:
数据库SQL:
数据库SQL:
drop table if exists T_CartItems; drop table if exists T_Consignee; drop table if exists T_Goods; drop table if exists T_Order; drop table if exists T_OrderItems; drop table if exists T_User; drop table if exists T_comment; create table T_CartItems ( cartItems_id int not null auto_increment, goods_id int, user_id int, cartItems_count int not null, primary key (cartItems_id) ); create table T_Consignee ( consignee_id int not null, user_id int, consignee_name varchar(20) not null, consignee_phone varchar(11) not null, consignee_postcode varchar(6), consignee_address varchar(1000) not null, primary key (consignee_id) ); create table T_Goods ( goods_id int not null auto_increment, goods_name varchar(20) not null, goods_price double not null, goods_url varchar(10), goods_memo varchar(1000), goods_state varchar(10) comment '1.上架 2.下架', primary key (goods_id) ); create table T_Order ( order_id int not null, user_id int, consignee_id int, order_createTime datetime not null, order_bill double not null, order_state varchar(10) not null comment '1.待付款 2.已付款', primary key (order_id) ); create table T_OrderItems ( orderItems_id int not null auto_increment, goods_id int, order_id int, orderItems_name varchar(100) not null, orderItems_price double not null, orderItems_count int not null, primary key (orderItems_id) ); create table T_User ( user_id int not null auto_increment, user_pass varchar(100) not null, user_nick varchar(20) not null, user_name varchar(20) not null, user_phone varchar(11) not null, user_sex varchar(10) not null, user_type varchar(10) comment '1.普通用户 2.管理员', primary key (user_id) ); create table T_comment ( comment_id int not null auto_increment, user_id int, goods_id int, comment_memo varchar(1000), comment_data datetime, primary key (comment_id) ); alter table T_CartItems add constraint fk_cartItems_goods foreign key (goods_id) references T_Goods (goods_id) on delete restrict on update restrict; alter table T_CartItems add constraint fk_cartItems_user foreign key (user_id) references T_User (user_id) on delete restrict on update restrict; alter table T_Consignee add constraint fk_consignee_user foreign key (user_id) references T_User (user_id) on delete restrict on update restrict; alter table T_Order add constraint fk_order_consignee foreign key (consignee_id) references T_Consignee (consignee_id) on delete restrict on update restrict; alter table T_Order add constraint fk_order_user foreign key (user_id) references T_User (user_id) on delete restrict on update restrict; alter table T_OrderItems add constraint fk_orderItems_goods foreign key (goods_id) references T_Goods (goods_id) on delete restrict on update restrict; alter table T_OrderItems add constraint fk_orderItems_order foreign key (order_id) references T_Order (order_id) on delete restrict on update restrict; alter table T_comment add constraint fk_comment_goods foreign key (goods_id) references T_Goods (goods_id) on delete restrict on update restrict; alter table T_comment add constraint fk_comment_user foreign key (user_id) references T_User (user_id) on delete restrict on update restrict;本文出自 “老牛Java” 博客,请务必保留此出处http://liuyj.blog.51cto.com/2340749/1711450
相关文章推荐
- UITextField实现UITextView监控值变化的功能textViewDidChange
- UIAlertView上添加输入框UITextField
- UGUI - 长按事件实现
- iOS 9界面适配利器:详解Xcode 7的新特性UIStackView
- PMC的第三代成帧器——META-240G
- LCS(Longest Common Subsequence 最长公共子序列)
- 77.下拉刷新MJRefresh和UITableView的section headerView冲突的原因分析与解决方案
- npm系列
- Android 腾讯入门教程( 智能手表UI设计 和 MVC模式 )
- Android开发UI之响应系统UI变化
- leetcode 303: Range Sum Query - Immutable
- 03(maven+SSH)之数据库设计(PMD)
- iOS摄像头和相册-UIImagePickerController-浅析
- Queue
- iOS 开发之UIAlertController
- 关于getparameter()取不到值的问题和jbuilder安装问题
- UIButton中内容大小,以及UITextFiled改变和选中
- 03(maven+SSH)网上商城项目实战之数据库设计(PMD)
- iOS UIDataDetectorType 详解
- 微软的COM中GUID和UUID、CLSID、IID .