毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

BBS论坛系统-数据库SQL Server 2000课程设计 第4页

更新时间:2008-9-12:  来源:毕业论文

BBS论坛系统-数据库SQL Server 2000课程设计 第4页

alter table bbsSection add constraint DF_StopicCount default(0) for StopicCount

alter table bbsSection add constraint Fk_SmasterID

foreign key(SmasterID) references bbsUsers(UID)

bbsTopic表添加约束条件

alter table bbsTopic add  constraint PK_TID primary key(TID)

alter table bbsTopic add constraint DF_TreplyCount default(0) for TreplyCount

alter table bbsTopic add constraint DF_Ttime default(getdate()) for Ttime

alter table bbsTopic add constraint DF_TclickCount default(0) for TclickCount

alter table bbsTopic add constraint DF_Tstate default(1) for Tstate

alter table bbsTopic add constraint FK_TsID

foreign key(TsID) references bbsSection(SID)

alter table bbsTopic add constraint FK_TuID

foreign key(TuID) references bbsUsers(UID)

bbsReply表添加约束条件

alter table bbsReply add constraint PK_RID primary key(RID)

alter table bbsReply add constraint DF_Rtime default(getdate()) for Rtime

alter table bbsReply add constraint FK_RtID

foreign key(RtID) references bbsTopic(TID)

alter table bbsReply add constraint FK_RsID

foreign key(RsID) references bbsSection(SID)

alter table bbsReply add constraint FK_RuID

foreign key(RuID) references bbsUsers(UID)

向四个表中录入数据

insert into bbsUsers(Uname,Upassword,Uemail,Ubirthday,Uremark,Upoint)

values('可卡因','HYXS007','ss@HotMail.com','1978-7-09','我要去公安局',50)

insert into bbsUsers(Uname,Upassword,Uemail,Ubirthday,Uremark,Upoint)

values('冬离儿','fangdong','bb@sohu.com','1976-10-03','爱迷失在天堂',1200)

insert into bbsUsers(Uname,Upassword,Uemail,Ubirthday,Uremark,Upoint)

values('Super','master','dd@p.com','1977-5-16','BBS大斑竹',5000)

select * from bbsUsers

go

insert into bbsSection (Sname,SmasterID,Sprofile,SclickCount,StopicCount)

values ('JAVA技术',3,'讨论JAVA相关技术',500,1)

insert into bbsSection (Sname,SmasterID,Sprofile,SclickCount,StopicCount)

values ('.net',2,'讨论Web Service',800,1)

insert into bbsSection (Sname,SmasterID,Sprofile,SclickCount,StopicCount)

values ('LinusUnix社区',2,'包含系统文',10,2)

select * from bbsSection

go

insert into bbsTopic

values (1,3,2,1,'还是jsp中的问题','jsp文件中读取','2007-10-10',200,1,'2007-10-11')

insert into bbsTopic

values (2,2,2,2,'部署.net中的问题','项目包括windows','2007-10-11',0,1,'2007-10-12')

select * from bbsTopic

go

insert into bbsReply(RtID,RsID,RuID,Rface,Rcontents,Rtime,RclickCount)

values (1,1,3,2,'数据库联接池在','2007-10-10',100)

insert into bbsReply(RtID,RsID,RuID,Rface,Rcontents,Rtime,RclickCount)

values (1,1,4,4,'public static date','2007-10-10',200)

insert into bbsReply(RtID,RsID,RuID,Rface,Rcontents,Rtime,RclickCount)

values (2,2,2,3,'帮测试人员架as','2007-10-10',0)

select * from bbsReply

go    

创建视图:为了向客户显示信息友好,查询各表,要求字段全为中文字段名。      

create view vbbsUsers

as

select 用户编号=UID,用户昵称=Uname,密码=Upassword,电子邮件=Uemail,性别=Usex,等级=Uclass,备注=Uremark,注册日期=UregDate,状态=Ustate,积分=Upoint

from bbsUsers

go

select * from vbbsUsers

 

create view vbbsSection

as

select版块编号=SID,版块名称=Sname,版主的用户编号=SmasterID,版面简介=Sprofile,点击率=SclickCount,发贴数=StopicCount

from  bbsSection

go

select * from  vbbsSection                                     

 

create view vbbsTopic

as

select 子编号=TID,所在版块编号=TsID,发人编号=TuID,回复数量=TreplyCount,发表情=Tface,标题=Ttopic,正文=Tcontents,发时间=Ttime,点击数=TclickCount,状态=Tstate,最后回复时间=TlastReply

from bbsTopic

go

select * from vbbsTopic

 

create view vbbsReply

as

select子编号=RID,回复的主编号=RtID,所在版块编号=RsID,回人编号=RuID,回=Rface,正文Rcontents,回时间=Rtime,点击率=RclickCount

from bbsReply

go

select * from vbbsReply

上一页  [1] [2] [3] [4] [5] [6] 下一页

BBS论坛系统-数据库SQL Server 2000课程设计 第4页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。