数据库系统概论课程设计1docWord文档格式.docx
- 文档编号:710224
- 上传时间:2023-04-29
- 格式:DOCX
- 页数:12
- 大小:400.93KB
数据库系统概论课程设计1docWord文档格式.docx
《数据库系统概论课程设计1docWord文档格式.docx》由会员分享,可在线阅读,更多相关《数据库系统概论课程设计1docWord文档格式.docx(12页珍藏版)》请在冰点文库上搜索。
3.1读者借阅图书
ExecuteRBorrowBook'
读者号'
'
图书分类号'
--------------读者借阅图书实例
useLibrarySystem
go
execRBorrowBookT006324,'
D630.3L836'
--其中T006324以T为标识,代表教师编号
execRBorrowBookS0*******1,'
---其中S0*******1以S为标识,代表学生学号
go
-----结果如下:
3.2读者归还图书
ExecuteRReturnBook'
----------------读者归还图书实例
execRReturnBookT006324,'
execRReturnBookS0*******1,'
go-----结果如下:
3.3读者续借图书
ExecuteRRenewBook'
--------------读者续借图书实例
-------读者借阅图书
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-----------结果如下:
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据库 系统 概论 课程设计 doc