供求信息网(2)

本文详细介绍了如何设计包含信息类别、付费与免费信息、广告及管理员表的数据库结构,并展示了具体的SQL语句,包括创建表、插入数据及创建序列。此外,还探讨了Java.util.Date与java.sql.Date的使用场景,以及Oracle数据库中的分页实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

信息的类别表,

管理员表,

--信息类别表

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值