资源描述
(完整word版)数据库课程设计《SQLServer图书馆管理系统》实例讲解
数据库系统概论课程设计
图书馆数据库管理系统
小组成员:
***
***
***
QQ:
目录
序言 1
一、图书馆管理系统 E-R 图 2
二、图书馆管理系统功能实现示意图 3
三、图书馆管理系统功能图例 4
3.1 读者借阅图书 4
3.2 读者归还图书 4
3.3 读者续借图书 5
3.4 读者查询借阅图书情况 5
3.5 读者检索图书信息 6
四、图书馆管理系统附加功能 7
4.1 往学生表中插入列"系部",其值等于学号中代表系部的位的值,再插入列"专业号",其值等于学号中代表专业的位的值 7
4.2 查询每个学生对书本的借阅数量 9
4.3 查询各个专业的学生借阅书本的数量 11
五、图书馆管理系统数据库、数据表源代码 12
5.1 图书馆管理系统"数据库"源代码 12
5.2 图书馆管理系统"数据表"源代码 12
六、图书馆管理系统存储过程源代码 15
6.1 读者借阅图书存储过程 15
6.2 读者还书存储过程 17
6.3读者续借图书存储过程 18
6.4 读者查询借阅图书情况存储过程 19
6.5 读者检索的图书信息存储过程 22
七、图书馆管理系统触发器源代码 23
7.1 借书要求(书本没有库存,则无法进行借书操作) 23
7.2 借书要求(读者最多借阅量) 24
7.3 续借次数要求 25
7.4 读者还书信息插入RDeleted表 26
主蒸汽及高、低温再热蒸汽系统采用单元制系统,均采用“双管、单管、双管”的布置方式。主蒸汽管道和高温再热蒸汽管道分别从过热器和再热器的出口联箱的两侧引出,然后汇成一根母管,到汽轮机前再分成两根支管分别接入高压缸和中压缸左右侧主汽关断阀和再热关断阀。the oil level to the normal oil level. (2) for the secondary prevention of the leakage of cooling water pipe fittings, valve parts before installation to check ... 4.2 measures to eliminate quality defects of cables cable laying in front of the cable construction, design, supervision and construction units to deliver the design, and drawing the third. Combined the engineering field to find fault, adding omitted items. Because the unit used computer DCS control and adds a great deal of control and signal cables. So you should carefully review, checks for missing physical cable, ready for construction and to verify cable length, specifications, familiar with the cable channel and the device location and bracket cable bracket on the section number. At the time of preparation of the inventory of cable, first of all, the professional carefully study electrical schematics, in accordance with the principle of accounting the cable path cable volume, the number of cores used, total volume and design inventory check cable to cable with and without omission, laying of the cable in order to ensure the process does not put a cable one cable. Finally, at the time of inventory, prepared to take the same path the cables together. Inventory preparation is completed, later in each enclosure affixed on both sides of each side of the cable you want to lay accurately verify cable lengths and set aside. Bridge should be combined, correcting errors, avoid straight, no cable bridge scaffolding used in the construction, not allowed to use electricity (fire) cutting, fix cable tray, cable tray is not allowed as a welding ground connection or cable tray cannot be used for other processes* 12 *
序言
本图书馆管理系统谨根据实际需求所创建,创建有如下八个数据表:Book(图书信息表),Dept(学生系部信息表),Major(学生专业信息表),Student(学生信息表),StudentBook(学生借阅图书信息表),Teacher(教师信息表),TeacherBook(教师借阅图书信息表),RDeleted(读者还书信息表)等。这些数据表结合图书馆数据库中的五个存储过程,即实现了普通图书馆的大部分功能。如读者借阅图书功能(Execute RBorrowBook '读者号','图书分类号'),读者归还图书功能(Execute RReturnBook '读者号','图书分类号'),读者续借图书功能(Execute RRenewBook '读者号','图书分类号'),读者查询图书借阅情况功能(Execute RQueryBook '读者号'),读者检索的图书信息功能(Execute RIndexBook '关键字')等。具体的功能表现皆在“第二章:图书馆管理系统功能”中有详细的图例说明。
本图书馆管理系统谨根据实际需要,创建了七个触发器,就此,创作者对这些触发器做如下说明:
1、 tri_Book 功能表现:只有在图书馆内相关书籍尚有库存的情况下,读者才可以进行借阅操作
2、 tri_SborrowNum 功能表现:控制学生的图书借阅量在5本以内(包括5本)
3、 tri_SrenewBook 功能表现:控制学生续借图书次数在3次以内(包括3次)
4、 tri_SreturnBook 功能表现:将学生的还书信息插入RDeleted表
5、 tri_TborrowNum 功能表现:控制教师的图书借阅量在10本以内(包括10本)
6、 tri_TrenewBook 功能表现:控制学生续借图书次数在4次以内(包括4次)
7、 tri_TreturnBook 功能表现:将教师的还书信息插入RDeleted表
本图书馆管理系统设计思路较为肤浅,但在一定程度上实现了图书馆数据库管理系统的实用功能。初次设计数据库,其中肯定会有不足之处,还望读者谅解!
本课程设计附有“图书馆数据库管理系统的所有源代码”,您可以根据需要在“第四章节”至“第七章节”中进行查看,或查看与本课程设计处于同一目录下的 *.sql 源代码文件!
作者:*** *** ***
一、图书馆管理系统 E-R 图
教师借阅图书期限较长,并且允许借阅的书本量较大。因此,将教师借阅关系与学生借阅关系分开较为适宜。
分类号
书名
作者
出版社
类别
出版日期
ISBN
价格
总量
借出量
年龄
电话
性别
姓名
学号
系部编号
系部名称
专业编号
专业名称
归属
归属
系部
专业
归属
学生学号与专业编号的联系
学生学号与系部编号的联系
系部编号与专业编号的联系
借阅日期
续借次数
借阅日期
续借次数
学生
图书
学生借阅
教师借阅
教师
工号
姓名
性别
年龄
职称
电话
二、图书馆管理系统功能实现示意图
相关信息写入
借阅图书
RBorrowBook
图书信息表
Book
学生借阅图书信息表 StudentBook
tri_Book图书库存量减1
tri_SborrowNum借阅量未超5本
学生借阅图书信息表 StudentBook
由于教师与学生的借阅图书、归还图书等等过程大致相同,在此,仅借学生有关表对象信息来对各存储过程作简要说明:
相关信息写入
归还图书
RReturnBook
读者还书信息表RDeleted
图书信息表
Book
学生借阅图书信息表 StudentBook
tri_SreturnBook图书库存量加1
tri_SborrowNum删除借阅记录
续借图书
RRenewBook
tri_SrenewBook续借次数不超三次,则将续借次数加1 相关信息写入
学生借阅图书信息表 StudentBook
学生借阅图书信息表 StudentBook
专业信息表
Major
学生信息表
Student
系部信息表
Dept
图书信息表
Book
查询图书借阅情况 RQueryBook
获取图书相关信息
计算学生专业信息
计算学生系部信息
获取学生相关信息
综合信息输出
图书信息表
Book
由存储过程RindexBook 查找匹配图书信息 综合信息输出给读者
读者检索图书
RIndexBook
三、图书馆管理系统功能图例
3.1 读者借阅图书
Execute RBorrowBook '读者号','图书分类号'
--------------读者借阅图书实例
use LibrarySystem
go
exec RBorrowBook T,'D630.3 L836'--其中T以T为标识,代表教师编号
exec RBorrowBook S,'D630.3 L836'---其中S以S为标识,代表学生学号
go -----结果如下:
3.2 读者归还图书
Execute RReturnBook '读者号','图书分类号'
----------------读者归还图书实例
use LibrarySystem
go
exec RReturnBook T,'D630.3 L836'
exec RReturnBook S,'D630.3 L836'
go -----结果如下:
3.3 读者续借图书
Execute RRenewBook '读者号','图书分类号'
--------------读者续借图书实例
use LibrarySystem
go
-------读者借阅图书
exec RBorrowBook T,'D630.3 L836'
exec RBorrowBook S,'D630.3 L836'
go
waitfor delay '0:0:5'
--------读者续借图书
exec RRenewBook T,'D630.3 L836'
exec RRenewBook S,'D630.3 L836'
go
-----结果如下:
3.4 读者查询借阅图书情况
Execute RQueryBook '读者号'
------------读者查询图书借阅情况实例
use LibrarySystem
go
exec RQueryBook T
exec RQueryBook S
go
-----结果如下:
3.5 读者检索图书信息
Execute RIndexBook '关键词'
------------读者检索图书信息实例
use LibrarySystem
go
exec RIndexBook 数据库
go
-------结果如下:
四、图书馆管理系统附加功能
4.1 往学生表中插入一列"系部",其值等于学号中代表系部的位的值,再插入一列"专业号",其值等于学号中代表专业的位的值
---------------往学生表S中插入一列"系部",其值等于学号中代表系部的位的值
use LibrarySystem
go
alter table Student
add SdeptNo char(2)
go
declare @sno char(10),@total int,@i int
select @total=count(*),@i=1
from Student
while(@i<=@total)
begin
------------查询数据表第@i 行数据的SQL语句
select top 1 @sno=Sno from Student where Sno not in(select top (@i-1) Sno from Student)
update Student
set SDeptNo=substring(@sno,4,2)
where Sno=@sno
set @i=@i+1
end
select * from Student
go
-----------结果如下:
-------------往学生表S中插入一列"专业号",其值等于学号中代表专业的位的值
use LibrarySystem
go
alter table Student
add SMajorNo varchar(50)
go
declare @sno char(10),@total int,@i int
select @total=count(*),@i=1
from Student
while(@i<=@total)
begin
------------查询数据表第@i 行数据的SQL语句
select top 1 @sno=Sno from Student where Sno not in(select top (@i-1) Sno from Student)
update Student
set SMajorNo=substring(@sno,4,4)
where Sno=@sno
set @i=@i+1
end
go
-----------结果如下:
4.2 查询每个学生对书本的借阅数量
--查询每个学生对书本的借阅数量
use LibrarySystem
go
select Student.Sno 学号,Sname 姓名,Book.ClassifyNo 图书分类号,Bname 书名
from StudentBook,Student,Book
where Student.Sno=StudentBook.Sno and StudentBook.ClassifyNo=Book.ClassifyNo
order by Student.Sno
compute count(Student.Sno) by Student.Sno
go
-----------结果如下:
4.3 查询各个专业的学生借阅书本的数量
use LibrarySystem
go
declare @tempDept table(
专业编号char(4)primary key,
专业varchar(30)not null,
学生借阅书本数量int default 0)
Insert into @tempDept(专业编号,专业) select Mno,Mname from Major
declare @i int,@total int,@no char(10)
select @total=count(*),@i=1 from StudentBook
while(@i<@total) begin
select top 1 @no=Sno from StudentBook where Sno not in(select top (@i-1) Sno from StudentBook)
update @tempDept
set 学生借阅书本数量=学生借阅书本数量+1
where 专业编号=substring(@no,4,4)
set @i=@i+1
end
select * from @tempDept
select @total as 学生借阅书本总量
go -----------结果如下:
后续“数据库课程设计之《SQL Server图书馆管理系统》源码”
五、图书馆管理系统数据库、数据表源代码
六、图书馆管理系统存储过程源代码
七、图书馆管理系统触发器源代码
QQ:
展开阅读全文