供求信息网(2)

根据需求文档,和给出的界面,我们开始设计数据库。

信息的类别表,

管理员表,

--信息类别表

create table infoType(

id number primary key,

name varchar2(50) not null

)

 create table infoType(
 id number primary key,
 name varchar2(50) not null);
insert into infoType values(1,'培训信息');
insert into infoType values(2,'招聘信息');
insert into infoType values(3,'家教信息');
insert into infoType values(4,'求职信息');

--付费信息表

create table payInfo

(

id number primary key,--付费信息的id而且是自增长的(sequence)

title varchar2(50) not null,--信息标题

content varchar2(500) not null,--信息的内容

linkman varchar2(100) not null,--人名

tel varchar2(20) not null,--电话

publishDate date not null,--发布日期

keeyDays number default 2 not null,--保留日期

checkState number(1) default 0 not null,--表示该信息是否通过审核

typeId number references infoType(id)

)

create table payInfo(
id number primary key,
title varchar2(50) not null,
content varchar2(500) not null,
linkman varchar2(100) not null,
tel varchar2(20) not null,
publishDate date not null,
keeyDays number default 2 not null,
checkState number(1) default 0 not null,
typeId number references infoType(id)
);

创建序列

create sequence payInfo_seq
start with 1
increment by 1
minvalue 1
maxvalue 9999999
nocache 
nocycle;

插入数据

insert into payInfo values(payInfo_seq.nextval,'hello',
'明天我们去找工作吧!','顺平','110',sysdate,2,0,4);

文章标题的字数的个数是有限制的。

--免费信息表(它和付费信息表基本一样)

create table freeInfo(
id number primary key,
title varchar2(50) not null,
content varchar2(500) not null,
linkman varchar2(100) not null,
tel varchar2(20) not null,
publishDate date default sysdate not null,
checkState number(1) default 0 not null,
typeId number references infoType(id)
);
create sequence freeInfo_seq
start with 1
increment by 1
minvalue 1
maxvalue 9999999
nocache
nocycle;
insert into freeInfo values(freeInfo_seq.nextval,'hello',
'明天我们去找工作吧!','顺平','110',sysdate,2,4);

--广告表

--管理员表

开始编写代码(程序)

1.创建工厂

2.创建包

3.引入响应的jar

4.建立文件

在java中有两个包中都有日期类,如果java中相关变量是和数据库相关的那么就用sql中的,否则用util

什么时候使用Java.util.Date,什么用java.Sql.Date?

答:当我们的java对象和数据库关联的时候,我们使用java.sql.Date,如果是service类,我们使用java.util.Date.

oracle的分页

select * from ( select t1.*,rownum rn from (select * from payInfo) t1 where rownum<=3) where rn >=1;

select * from ( select t1.*,rownum rn from (select * from payInfo) t1 where rownum<=3) where rn >=1;
原文地址:https://www.cnblogs.com/liaoxiaolao/p/9880215.html