tmall_sql语句表

CREATE TABLE category (
  id int identity(1,1) primary key,
  name varchar(255) null,

CREATE TABLE users (
  id int identity(1,1) primary key,
  name varchar(255) null,
  passwords varchar(255) null,

--依赖用户表
CREATE TABLE order_ (
  id int identity(1,1) primary key,
  orderCode varchar(255) NULL,
  useraddress varchar(255) DEFAULT NULL,
  post varchar(255) DEFAULT NULL,
  receiver varchar(255) DEFAULT NULL,
  mobile varchar(255) DEFAULT NULL,
  userMessage varchar(255) DEFAULT NULL,
  createDate datetime DEFAULT NULL,
  payDate datetime DEFAULT NULL,
  deliveryDate datetime DEFAULT NULL,
  confirmDate datetime DEFAULT NULL,
  uid int DEFAULT NULL,
  status varchar(255) DEFAULT NULL,
  CONSTRAINT fk_order_user FOREIGN KEY (uid) REFERENCES users (id)

--依赖分类表
CREATE TABLE product (
  id int identity(1,1) primary key,
  name varchar(255) DEFAULT NULL,
  subTitle varchar(255) DEFAULT NULL,
  orignalPrice float DEFAULT NULL,
  promotePrice float DEFAULT NULL,
  stock int DEFAULT NULL,
  cid int DEFAULT NULL,
  createDate datetime DEFAULT NULL,
   CONSTRAINT fk_product_category FOREIGN KEY (cid) REFERENCES category (id)

--依赖产品表
CREATE TABLE productimage (
  id int identity(1,1) primary key,
  pid int DEFAULT NULL,
  type varchar(255) DEFAULT NULL,
  CONSTRAINT fk_productimage_product FOREIGN KEY (pid) REFERENCES product (id)

--依赖分类表
CREATE TABLE property (
  id int identity(1,1) primary key,
  cid int DEFAULT NULL,
  name varchar(255) DEFAULT NULL,
  CONSTRAINT fk_property_category FOREIGN KEY (cid) REFERENCES category (id)

--依赖属性表
CREATE TABLE propertyvalue (
  id int identity(1,1) primary key,
  ptid int DEFAULT NULL,
  value varchar(255) DEFAULT NULL,
  CONSTRAINT fk_propertyvalue_property FOREIGN KEY (ptid) REFERENCES property (id)
  

--依赖用户和产品表
CREATE TABLE review (
  id int identity(1,1) primary key,
  content varchar(4000) DEFAULT NULL,
  uid int DEFAULT NULL,
  pid int DEFAULT NULL,
  createDate datetime DEFAULT NULL,
  CONSTRAINT fk_review_product FOREIGN KEY (pid) REFERENCES product (id),
  CONSTRAINT fk_review_user FOREIGN KEY (uid) REFERENCES users (id)

--依赖用户和产品表
CREATE TABLE orderitem (
  id int identity(1,1) primary key,
  pid int DEFAULT NULL,
  oid int DEFAULT NULL,
  uid int DEFAULT NULL,
  number int DEFAULT NULL,
  CONSTRAINT fk_orderitem_user FOREIGN KEY (uid) REFERENCES users (id),
  CONSTRAINT fk_orderitem_product FOREIGN KEY (pid) REFERENCES product (id)
)
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值