商品评论表设计

总共5张表,设计如下:
create sequence SEQ_TRADESCORE_AUTOINC
minvalue 1
maxvalue 9999999999999
start with 1
increment by 1
nocache;
-- Create table
create table TBTRADESCORE
(
  ID NUMBER(13) not null,
  PRODUCTCODE   VARCHAR2(24),
  TYPE NUMBER(2),
  SCORESUM    NUMBER(9),
  NUM   NUMBER(9),
  CREATETIME DATE,
  STATE NUMBER(2)
)

tablespace XWXDB
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64
    next 8
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table TBTRADESCORE
  is '交易评分总表';
-- Add comments to the columns
comment on column TBTRADESCORE.PRODUCTCODE
  is '产品编号';
comment on column TBTRADESCORE.TYPE
  is '类型 0未知 1 自行车 2路书';
comment on column TBTRADESCORE.SCORESUM
  is '评分总得分数';
comment on column TBTRADESCORE.NUM
  is '评分次数';
comment on column TBTRADESCORE.CREATETIME
  is '创建时间';
comment on column TBTRADESCORE.STATE
  is '状态 0 正常 99 删除';


create sequence SEQ_TRADESCOREDETAIL_AUTOINC
minvalue 1
maxvalue 9999999999999
start with 1
increment by 1
nocache;
-- Create table
create table TBTRADESCOREDETAIL
(
  ID NUMBER(13) not null,
  SCOREID NUMBER(13) not null,
  CUST_CODE VARCHAR2(24),
  SCORE     NUMBER(2),
  CREATETIME DATE,
  MODIFYTIME DATE,
  STATE NUMBER(2),
  REMARK VARCHAR2(255)
)
tablespace XWXDB
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64
    next 8
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table TBTRADESCOREDETAIL
  is '交易评分明细表';
-- Add comments to the columns
comment on column TBTRADESCOREDETAIL.SCOREID
  is 'ID 来自TBTRADESCORE的ID';
comment on column TBTRADESCOREDETAIL.CUST_CODE
  is '用户编号';
comment on column TBTRADESCOREDETAIL.SCORE
  is '分数';
comment on column TBTRADESCOREDETAIL.CREATETIME
  is '创建时间';
comment on column TBTRADESCOREDETAIL.MODIFYTIME
  is '修改时间';
comment on column TBTRADESCOREDETAIL.STATE
  is '状态 0 正常 99 删除';
comment on column TBTRADESCOREDETAIL.REMARK
  is '备注';

create sequence SEQ_TRADECOMMENT_AUTOINC
minvalue 1
maxvalue 9999999999999
start with 1
increment by 1
nocache;
-- Create table
create table TBTRADECOMMENT
(
  ID NUMBER(13) not null,
  PRODUCTCODE   VARCHAR2(24),
  TYPE NUMBER(2),
  COMMENTSUM NUMBER(9),
  REPLYSUM      NUMBER(9),
  CREATETIME   DATE,
  STATE NUMBER(2)
)
tablespace XWXDB
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64
    next 8
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table TBTRADECOMMENT
  is '交易评论总表';
-- Add comments to the columns
comment on column TBTRADECOMMENT.PRODUCTCODE
  is '产品编号';
comment on column TBTRADECOMMENT.TYPE
  is '类型 0未知 1 自行车 2路书';
comment on column TBTRADECOMMENT.COMMENTSUM
  is '评论总数';
comment on column TBTRADECOMMENT.REPLYSUM
  is '回复总数';
comment on column TBTRADECOMMENT.CREATETIME
  is '创建时间';
comment on column TBTRADECOMMENT.STATE
  is '状态 0 正常 99 删除';

create sequence SEQ_TRADECOMMENTDETAIL_AUTOINC
minvalue 1
maxvalue 9999999999999
start with 1
increment by 1
nocache;
-- Create table
create table TBTRADECOMMENTDETAIL
(
ID NUMBER(13) not null,
  COMMENTID NUMBER(13) not null,
  FROMID NUMBER(13),
  CUSTCODE VARCHAR2(24),
  TYPE NUMBER(2),
  REMARK VARCHAR2(255),
  CREATETIME   DATE,
  MODIFYTIME DATE,
  STATE NUMBER(2)
)
tablespace XWXDB
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64
    next 8
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table TBTRADECOMMENTDETAIL
  is '交易评论明细表';
-- Add comments to the columns
comment on column TBTRADECOMMENTDETAIL.COMMENTID
  is '过滤关键字';
comment on column TBTRADECOMMENTDETAIL.FROMID
  is '来源ID 来自本表的ID';
comment on column TBTRADECOMMENTDETAIL.CUSTCODE
  is '用户编号';
comment on column TBTRADECOMMENTDETAIL.TYPE
  is '类型 0评论 1回复';
comment on column TBTRADECOMMENTDETAIL.REMARK
  is '评语';
comment on column TBTRADECOMMENTDETAIL.CREATETIME
  is '创建时间';
comment on column TBTRADECOMMENTDETAIL.MODIFYTIME
  is '修改时间';
comment on column TBTRADECOMMENTDETAIL.STATE
  is '状态 0 正常 99 删除';

create sequence SEQ_COMMENTFILTERKEY_AUTOINC
minvalue 1
maxvalue 9999999999999
start with 1
increment by 1
nocache;
-- Create table
create table TBCOMMENTFILTERKEY
(
ID NUMBER(13) not null,
  FILTERVALUE VARCHAR2(255)
)
tablespace XWXDB
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64
    next 8
    minextents 1
    maxextents unlimited
  );
-- Add comments to the table 
comment on table TBCOMMENTFILTERKEY
  is '评论过滤关键字表';
comment on column TBCOMMENTFILTERKEY.FILTERVALUE
  is '过滤关键字';

你可能感兴趣的:(商品评论表设计)