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 sysdate 17 ); 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_SEQ 11 minvalue 1 12 maxvalue 99999999999999 13 start with 1000 14 increment by 1 15 cache 10 16 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_SEQ 29 minvalue 1 30 maxvalue 99999999999999 31 start with 1000 32 increment by 1 33 cache 10 34 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_SEQ 46 minvalue 1 47 maxvalue 99999999999999 48 start with 1000 49 increment by 1 50 cache 10 51 order;