数据库系统概论课程设计.docx

上传人:b****5 文档编号:7482402 上传时间:2023-01-24 格式:DOCX 页数:11 大小:401.01KB
下载 相关 举报
数据库系统概论课程设计.docx_第1页
第1页 / 共11页
数据库系统概论课程设计.docx_第2页
第2页 / 共11页
数据库系统概论课程设计.docx_第3页
第3页 / 共11页
数据库系统概论课程设计.docx_第4页
第4页 / 共11页
数据库系统概论课程设计.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

数据库系统概论课程设计.docx

《数据库系统概论课程设计.docx》由会员分享,可在线阅读,更多相关《数据库系统概论课程设计.docx(11页珍藏版)》请在冰豆网上搜索。

数据库系统概论课程设计.docx

数据库系统概论课程设计

 

图书馆数据库管理系统

 

一、图书馆管理系统E-R图

教师借阅图书期限较长,并且允许借阅的书本量较大。

因此,将教师借阅关系与学生借阅关系分开较为适宜。

 

二、图书馆管理系统功能实现示意图

由于教师与学生的借阅图书、归还图书等等过程大致相同,在此,仅借学生有关表对象信息来对各存储过程作简要说明:

 

 

 

三、图书馆管理系统功能图例

3.1读者借阅图书

ExecuteRBorrowBook'读者号','图书分类号'

--------------读者借阅图书实例

useLibrarySystem

go

execRBorrowBookT006324,'D630.3L836'--其中T006324以T为标识,代表教师编号

execRBorrowBookS*********,'D630.3L836'---其中S*********以S为标识,代表学生学号

go

-----结果如下:

3.2读者归还图书

ExecuteRReturnBook'读者号','图书分类号'

----------------读者归还图书实例

useLibrarySystem

go

execRReturnBookT006324,'D630.3L836'

execRReturnBookS0*******1,'D630.3L836'

go-----结果如下:

3.3读者续借图书

ExecuteRRenewBook'读者号','图书分类号'

--------------读者续借图书实例

useLibrarySystem

go

-------读者借阅图书

execRBorrowBookT006324,'D630.3L836'

execRBorrowBookS0*******1,'D630.3L836'

go

waitfordelay'0:

0:

5'

--------读者续借图书

execRRenewBookT006324,'D630.3L836'

execRRenewBookS0*******1,'D630.3L836'

go

-----结果如下:

3.4读者查询借阅图书情况

ExecuteRQueryBook'读者号'

------------读者查询图书借阅情况实例

useLibrarySystem

go

execRQueryBookT006432

execRQueryBookS0*******1

go

-----结果如下:

 

3.5读者检索图书信息

ExecuteRIndexBook'关键词'

------------读者检索图书信息实例

useLibrarySystem

go

execRIndexBook数据库

go

-------结果如下:

四、图书馆管理系统附加功能

4.1往学生表中插入一列"系部",其值等于学号中代表系部的位的值,再插入一列"专业号",其值等于学号中代表专业的位的值

---------------往学生表S中插入一列"系部",其值等于学号中代表系部的位的值

useLibrarySystem

go

altertableStudent

addSdeptNochar

(2)

go

declare@snochar(10),@totalint,@iint

select@total=count(*),@i=1

fromStudent

while(@i<=@total)

begin

------------查询数据表第@i行数据的SQL语句

selecttop1@sno=SnofromStudentwhereSnonotin(selecttop(@i-1)SnofromStudent)

updateStudent

setSDeptNo=substring(@sno,4,2)

whereSno=@sno

set@i=@i+1

end

select*fromStudent

go

-----------结果如下:

-------------往学生表S中插入一列"专业号",其值等于学号中代表专业的位的值

useLibrarySystem

go

altertableStudent

addSMajorNovarchar(50)

go

declare@snochar(10),@totalint,@iint

select@total=count(*),@i=1

fromStudent

while(@i<=@total)

begin

------------查询数据表第@i行数据的SQL语句

selecttop1@sno=SnofromStudentwhereSnonotin(selecttop(@i-1)SnofromStudent)

updateStudent

setSMajorNo=substring(@sno,4,4)

whereSno=@sno

set@i=@i+1

end

go

-----------结果如下:

4.2查询每个学生对书本的借阅数量

--查询每个学生对书本的借阅数量

useLibrarySystem

go

selectStudent.Sno学号,Sname姓名,Book.ClassifyNo图书分类号,Bname书名

fromStudentBook,Student,Book

whereStudent.Sno=StudentBook.SnoandStudentBook.ClassifyNo=Book.ClassifyNo

orderbyStudent.Sno

computecount(Student.Sno)byStudent.Sno

go

-----------结果如下:

4.3查询各个专业的学生借阅书本的数量

useLibrarySystem

go

declare@tempDepttable(

专业编号char(4)primarykey,

专业varchar(30)notnull,

学生借阅书本数量intdefault0)

Insertinto@tempDept(专业编号,专业)selectMno,MnamefromMajor

declare@iint,@totalint,@nochar(10)

select@total=count(*),@i=1fromStudentBook

while(@i<@total)begin

selecttop1@no=SnofromStudentBookwhereSnonotin(selecttop(@i-1)SnofromStudentBook)

update@tempDept

set学生借阅书本数量=学生借阅书本数量+1

where专业编号=substring(@no,4,4)

set@i=@i+1

end

select*from@tempDept

select@totalas学生借阅书本总量

go-----------结果如下:

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 学科竞赛

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1