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

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

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

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

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

3.1读者借阅图书

ExecuteRBorrowBook'

读者号'

'

图书分类号'

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

useLibrarySystem

go

execRBorrowBookT006324,'

D630.3L836'

--其中T006324以T为标识,代表教师编号

execRBorrowBookS*********,'

---其中S*********以S为标识,代表学生学号

go

-----结果如下:

3.2读者归还图书

ExecuteRReturnBook'

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

execRReturnBookT006324,'

execRReturnBookS0*******1,'

go-----结果如下:

3.3读者续借图书

ExecuteRRenewBook'

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

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

execRBorrowBookS0*******1,'

waitfordelay'

0:

5'

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

execRRenewBookT006324,'

execRRenewBookS0*******1,'

go

-----结果如下:

3.4读者查询借阅图书情况

ExecuteRQueryBook'

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

execRQueryBookT006432

execRQueryBookS0*******1

3.5读者检索图书信息

ExecuteRIndexBook'

关键词'

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

execRIndexBook数据库

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

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

4.1往学生表中插入一列"

系部"

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

专业号"

,其值等于学号中代表专业的位的值

---------------往学生表S中插入一列"

,其值等于学号中代表系部的位的值

altertableStudent

addSdeptNochar

(2)

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

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

-------------往学生表S中插入一列"

addSMajorNovarchar(50)

setSMajorNo=substring(@sno,4,4)

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

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

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

fromStudentBook,Student,Book

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

orderbyStudent.Sno

computecount(Student.Sno)byStudent.Sno

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

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

declare@tempDepttable(

专业编号char(4)primarykey,

专业varchar(30)notnull,

学生借阅书本数量intdefault0)

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

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

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

@total)begin

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

update@tempDept

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

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

select*from@tempDept

select@totalas学生借阅书本总量

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

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

当前位置:首页 > 农林牧渔 > 林学

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

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