1.数据库设计
1 -- 问题 -- 2 create table pxpt_bbs_question( 3 id number primary key, 4 site_id number not null, 5 login_name varchar2(64), 6 question_title varchar2(64), 7 question_content varchar2(256), 8 created_date date default sysdate 9 );10 -- 评论 --11 create table pxpt_bbs_question_solution(12 solution_id number primary key,13 question_id number foreign key references pxpt_bbs_question(id),14 login_name varchar2(64),15 solution_back_id number default 0, --本身id 回复时使用16 solution_date date default sysdate17 );18 -- 点赞--19 create table pxpt_bbs_question_like(20 like_id number primary key,21 question_id number foreign key references pxpt_bbs_question(id),22 login_name varchar2(64)23 )
完整Oracle:
1 -- 问题 -- 2 create table pxpt_bbs_question( 3 id number primary key, 4 site_id number not null, 5 login_name varchar2(64), 6 question_title varchar2(64), 7 question_content varchar2(256), 8 created_date date default sysdate 9 );10 create sequence pxpt_bbs_question_SEQ11 minvalue 112 maxvalue 9999999999999913 start with 100014 increment by 115 cache 1016 order;17 18 -- 评论 --19 create table pxpt_bbs_question_solution(20 solution_id number primary key,21 question_id number ,22 login_name varchar2(64),23 solution_back_id number default 0, --本身id 回复时使用24 solution_date date default sysdate,25 foreign key(question_id) references pxpt_bbs_question(id)26 );27 28 create sequence pxpt_bbs_question_solution_SEQ29 minvalue 130 maxvalue 9999999999999931 start with 100032 increment by 133 cache 1034 order;35 36 37 -- 点赞--38 create table pxpt_bbs_question_like(39 like_id number primary key,40 question_id number,41 login_name varchar2(64),42 foreign key(question_id) references pxpt_bbs_question(id)43 );44 45 create sequence pxpt_bbs_question_like_SEQ46 minvalue 147 maxvalue 9999999999999948 start with 100049 increment by 150 cache 1051 order;