版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、数据库课程设计 课设名称:图书管理系统数据库设计与实现 年 级: 专 业:网络工程 班 级: 姓 名: 学 号: 成 绩: 指导教师:颜 颖 提交报告时间:2015 年1 月14 日 数据需求 图书馆管理信息系统需要完成功能主要有: 1读者基本信息的输入,包括借书证编号、读者姓名、读者性别登记日期。 2. 读者基本信息的查询、修改,包括读者借书证编号、读者姓名、性别等。 3 书籍类别标准的制定、类别信息的输入,包括类别编号、类别名称。 4. 书籍类别信息的查询、修改,包括类别编号、类别名称。 5. 书籍库存信息的输入,包括书籍编号、书籍名称、书籍类别编号、作者、 出版社、出版日期、登记日期,价
2、格,是否可借。 6. 书籍库存信息的查询,修改,包括书籍编号、书籍名称、书籍类别编号、 姓名、出版社、出版日期、登记日期、价格、是否可借等。 7借书信息的输入, 包括读者借书证号、 书籍编号、 借书日期, 应还时间。 8借书信息的查询、修改,包括借书证编号、读者编号、读者姓名、书籍 编号、书籍名称、借书日期等。 9还书信息的输入,包括借书证编号、书籍编号、还书日期。 10还书信息的查询和修改,包括还书读者借书证编号、读者姓名、书籍 编号、书籍名称、借书日期、还书日期等。 11超期还书罚款输入, 还书超出期限包括超出期限还书的读者借阅证号, 书籍编号,罚款金额。 12. 超期还书罚款查询, 删除
3、,包括读者借书证编号、 读者姓名、 书籍编号、 书籍名称,应还时间,罚款金额,借阅时间,超期时间等 事物需求 (1) 在读者信息管理部分 , 要求: a. 可以查询读者信息。 b.可以对读者信息进行添加及删除的操作。 (2 ) 在书籍信息管理部分 , 要求: a. 可以浏览书籍信息 , 要求: b. 可以对书籍信息进行维护 , 包括添加及删除的操作。 (3) 在借阅信息管理部分 , 要求: 。 a. 可以浏览借阅信息。 b. 可以对借阅信息进行维护操作。 (4) 在归还信息管理部分,要求 : a. 可以浏览归还信息 b. 对归还信息可修改维护操作 (5)在管理者信息管理部分,要求: a. 显示
4、当前数据库中管理者情况。 b. 对管理者信息维护操作。 (6)在罚款信息管理部分,要求: a. 可以浏览罚款信息 b. 对罚款信息可以更新 (7)在书籍类别管理部分,要求: A. 可以浏览书籍类别信息 B. 对书籍类别信息可以更新 (8)在系部信息管理部分,要求: B.可以系部信息 B.对系部信息可以进行增删改操作 关系模式 (一)书籍类别(书籍类别编号,类别名称) (二)借阅者信息实体(借阅证号,姓名,性别,登记时期,读者类别) (三)学生实体(读者类别,学号昔阅数,专业,电话) (四)教师实体(读者类别,职位,工号,借阅数,电话) (五)书籍(书籍编号,书籍名称,书籍类别编号,作者,出版社
5、,出版日期, 价格,登记日期,是否可借) (六)借阅(借阅证号,书籍编号,借阅时间时间,应还时间) (七)还书(借阅证号,书籍编号,还书时间) (八)罚款(借阅证号,姓名,书籍名称,书籍编号,借阅时间,应还时间, 还书时间,罚款金额) (九)系部(系部名称,系部编号) (十)读者类别表(读者类别编号,读者类别名称) E/R图 总的信息实体E-R图 数据字典 表2 -1 book_sytle书籍类别信息表 表中列名 数据类型 可否为空 说明 bookstyle no Varchar(20) not null(主键) 书籍类别编号 bookstyle Varchar(30) not n ull 种
6、类名称 表2 -2 system_readers借阅者信息表格 表中列名 数据类型 可否为空 说明 readerid Varchar(9) not null(主键) 借阅证号 reader name Varchar(9) not n ull 读者姓名 readersex Varchar(2) not n ull 读者性别 readertype Varchar(10) Not null 读者类别 regdate datetime n ull 登记日期 表2-3 system_books书籍信息表 表中列名 数据类型 可否为空 说明 bookid Varchar(20) Not null(主键)
7、书耒曰编号 price Varchar(6) Not null 价格 book name Varchar(30) Not null 书籍名称 Bookstyle no Varchar(20) Not null 书籍类别编号 bookauthor Varchar(30) Not null 作者 isborrowed Varchar(1) Not null 是否可借 bookpub Varchar(30) Null 出版社 bookpubdate Datetime Null 出版日期 book in date Datetime Null 登记日期 表2-4 borrow_record 借阅记录信息
8、表 表中列名 数据类型 可否为空 说明 readerid Varchar(9) Not null(外主 键) 借阅证号 bookid Varchar(20) Not null(外主 键) 书耒曰编号 borrowdate datetime Not null 借阅时间 shouldretur n datetime ? 应还时间 表2-5 return_record还书记录信息表 表中列名 数据类型 可否为空 说明 readerid Varchar(9) Not null(外主 借阅证号 键) bookid Varchar(20) Not null(外主 键) 书耒曰编号 retur ndate
9、datetime Not null 读者还书时间 表2-6 reader_fee 罚款记录信息表 readerid Varchar (9) Not null (外主 键) 借阅证号 reader name Varchar(9) Not null 读者姓名 bookid Varchar(20) Not null(外主 键) 书耒曰编号 book name Varchar(30) Not null 书籍名称 bookfee Varchar(10) Not Null 罚款金额 borrowdate datetime Not Null 借阅时间 shouldretur n datetime null
10、应还时间 exceeddate datetime null 超期时间 表2-7 system_student学生实体信息表 表中列名 数据类型 可否为空 说明 stude ntno Varchar(20) not null(主键) 学号 major Varchar(30) not n ull 专业 borrow num Int not n ull 借阅数 readertype Varchar(10) Not null 读者类别 phone Varchar(20) n ull 电话 表2-8 system_teacher教师实体信息表 表中列名 数据类型 可否为空 说明 teachert no
11、Varchar ( 20) not null(主键) 工号 Professio n Varchar ( 20) n ull 职位 borrow num Int not n ull 借阅数 readertype Varchar ( 20) Not null 读者类别 phone Varchar ( 20) n ull 电话 表 2-9 System_department系部信息表 表中列名 数据类型 可否为空 说明 departme ntno Varchar(20) not null(主键) 系部编号 deparme ntn ame Varchar ( 20) not n ull 系部名称 表
12、2-10system_resdertype 读者类另U表 表中列名 数据类型 可否为空 说明 readertype no Varchar(20) Not null(主键) 读者类别编号 Readertype Varchar(20) Not null 读者类别名称 建表语句: 1. 书本类别表建立 create table book_style ( bookstyle novarchar (20) primary key, bookstyle varchar (30) not null ) 2. 书籍表建立 create table system_books ( bookid varchar (
13、20) primary key, bookname varchar (20) Not null, bookstyleno varchar (30) Not null, price varchar ( 6) not null, bookauthor varchar (30) not null, isborrowed varchar (1) not null, bookpub varchar ( 30) , bookpubdate datetime , bookindate datetime , foreign key ( bookstyleno ) references book_style (
14、 bookstyleno ), ) 3. 借阅者表建立 create table system_readers ( readerid varchar (9) primary key, readername varchar (9) not null , readersex varchar (2) not null, readertype varchar (10) not null, regdate datetime ) 4. 借书记录表建立 create table borrow_record ( bookid varchar (20) primary key, readerid varchar
15、 (9) not null, borrowdate datetime not null , shouldreturn datetime , foreign key ( bookid ) references system_books ( bookid ), foreign key ( readerid ) references system_readers ( readerid ), ) 5. 还书记录表建立 create table return_record ( bookid varchar (20) primary key, readerid varchar ( 9)not null,
16、returndate datetime not null, foreign key ( bookid ) references system_books ( bookid ), foreign key ( readerid ) references system_readers ( readerid ) ) 6. 罚款单表建立 */ create table reader_fee ( readerid varchar ( 9)not null, readername varchar ( 9)not null , bookid varchar (20) primary key, bookname
17、 varchar (30) Not null, bookfee varchar ( 10) not null, borrowdate datetime not null, shouldreturn datetime , exceeddate varchar (5) , foreign key ( bookid ) references system_books ( bookid ), foreign key ( readerid ) references system_readers ( readerid ) ) 7. 学生表建立 create table system_student ( s
18、tudentno varchar ( 20) primary key, major varchar (30) not null, borrownum int not null, readertype varchar (20) , phone varchar ( 20) ) 8. 读者类别表建立 create table system_readertype ( readertypeno varchar (20) primary key, readertype varchar (20) not null ) 9. 系别表建立 create table system_department ( dep
19、artmentno varchar (20) primary key, departmentname varchar (20) not null ) 10教师表建立 create table system_teacher ( readerid varchar ( 9)not null, teacherno varchar ( 20) primary key, borrownum int not null, profession varchar (20), readertype varchar (20) not null, phone varchar ( 20), foreign key ( r
20、eaderid ) references system_readers ( readerid ) ) 数据初始化及表更新、查询 1. 向 Book_style 表中插入数据 insert into book_style (bookstyleno ,bookstyle )values ( 1 , 人文艺术类 ) insert into book_style (bookstyleno ,bookstyle )values ( 2 , 自然科学类 ) insert into book_style (bookstyleno ,bookstyle )values ( 3 , 社会科学类 ) insert
21、 into book_style (bookstyleno ,bookstyle )values ( 4 , 图片艺术类 ) insert into book_style (bookstyleno ,bookstyle )values ( 5 , 政治经济类 ) insert into book_style (bookstyleno ,bookstyle )values ( 6 , 工程技术类 ) insert into book_style (bookstyleno ,bookstyle )values ( 7 , 语言技能类 ) 表单查询: select * from book_style
22、 2. 向 system_books 表中插入数据: insert into system_books ( bookid , bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum , totalnum ) values (, 计算机组成原理 ,6 , 王爱英 , 清华大学出版社 , 2001-01-03 , 2003-11-15 , ,3 ,10 ); insert into system_books ( bookid , bookname, bookstyle
23、no , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum , totalnum ) values ( 00456456 , 数据库原理 ,6 , 萨师煊 , 高等教育出版社 , 2007-07-02 , 2007-09-15 , 40 ,4 ,10 ); insert into system_books ( bookid , bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowed
24、num , totalnum ) values (, C 程序设计,6,谭浩强,清华大学岀版社,2002-04-02, 2004-03-14, 60 , 5 , 8); insert into system_books ( bookid ,bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum,totalnum ) values (, 计算机体系结构 , 6 , 石教英 , 浙江大学岀版社 , 2004-10-03,2006-11-15,60 ,5 ,8 ); i
25、nsert into system_books ( bookid ,bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum,totalnum ) values (, 数 据 结 构 ( C 语 言 版 ) , 6 , 吴 伟 民 , 严 蔚 敏 , 清 华 大 学 岀 版 社 , 2002-06-28,2004-01-21,40 ,5 ,10 ); insert into system_books ( bookid ,bookname, bookstyleno ,
26、 bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum,totalnum ) values (, 中华历史年 ,1 ,吴强,北京大学岀版社 , 2005-04-03, 2006-05-15,56 ,0 ,10 ); insert into system_books ( bookid ,bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum,totalnum ) values (,
27、 日本文化 ,1 ,吴小鹏,北京大学岀版社 , 2002-04-02, 2004-03-14,35 ,0 ,10 ); insert into system_books ( bookid ,bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum,totalnum ) values (, 微观经济学 , 5 , 李小刚 , 北京大学出版社 , 2000-10-03 , 2001-11-15 , 35 ,0 ,10 ); insert into system_book
28、s ( bookid , bookname, bookstyleno , bookauthor , bookpub , bookpubdate , bookindate , price , borrowednum , totalnum ) values (, 影视文学 , 4 , 苏庆东 , 北京大学出版社 , 1999-02-28 , 2000-01-21 , 35 , 0 , 10 ); insert into system_books ( bookid , bookname, bookstyleno , bookauthor , bookpub , bookpubdate , booki
29、ndate , price , borrowednum , totalnum ) values (, 探索宇宙奥秘 , 2 , 苏庆东 , 北京大学出版社 , 1999-02-28 , 2000-01-21 , 35 ,0 ,10 ); 表单查询: select * from system_books 3. 向读者表中插入数据: insert into system_readers ( readerid , readername , readersex , readertype , regdate ) insert into system_readers ( readerid , reader
30、name , readersex , readertype , regdate values ( X05620207 , 陈飞 , 男 ,1 , 2005-9-23 14:23:56) insert into system_readers ( readerid , readername , readersex , readertype , regdate values ( X05620206 , 张三 , 男 ,1 , 2005-09-30 13:24:) insert into system_readers ( readerid , readername , readersex , read
31、ertype , regdate values ( X05620204 , 赵静 , 女 ,1 , 2005-09-27 11:24:) insert into system_readers ( readerid , readername , readersex , readertype , regdate values ( X05620202 , 潘小虹 , 女 ,1 , 2005-09-30 13:24: ) insert into system_readers ( readerid , readername , readersex , readertype , regdate ) ) )
32、 ) ) values ( 008415 , 蒋伟 , 男 , 2 , 2004-04-30 09:24: ) values ( 001456 ,李风 , 女 , 2 , 2004-04-30 09:24: ) 表单查询: select * from system_readers 4. (insert , update ,set )向借书记录表中加入数据: insert into borrow_record ( bookid , readerid , borrowdate , shouldreturn ) values (, X05620207 , 2007-09-27 11:24:, 200
33、7-10-27 11:24:) update system_books set isborrowed=0 where bookid = and isborrowed=1 insert into borrow_record ( bookid , readerid , borrowdate , shouldreturn ) values (, X05620204 , 2014-09-03 10:24:, 2014-10-03 10:24:) update system_books set isborrowed=0 where bookid = and isborrowed=1 insert int
34、o borrow_record ( bookid , readerid , borrowdate , shouldreturn ) values (, 001456 , 2014-09-03 10:24:, 2014-12-03 10:24: ) update system_books set isborrowed=0. where bookid = and isborrowed=1 5向学生表中加入数据 insert into system_student ( readerid , studentno , readertype , major , borrownum , phone valu
35、es ( X05620207 , 1 , 计算机 ,30 ,) insert into system_student ( readerid , studentno , readertype , major , borrownum , phone values ( X05620206 , 1 , 计算机 ,30 ,) insert into system_student ( readerid , studentno , readertype , major , borrownum , phone values ( X05620202 , 1 , 哲学与社会 ,30 ,) insert into
36、system_student ( readerid , studentno , readertype , major , borrownum , phone ) ) ) ) values ( X05620204 , 1 , 国际经济与贸易 ,30 ,) (DELETE删除学生操作: delete from system_student where readerid = X05620204 系部信息表: 6. 向教师表中加入数据: , borrownum , phone ) , borrownum , phone ) insert into system_teacher ( readerid , teacherno , readertype , profession values ( 001456 , 2 , 数据库教师 , 40 ,) insert into system_teacher ( readerid , teacherno , readertype , profession values ( 008415 , 2 ,C 语言教师 ,40 ,) 7. (DISTINCT, 多表查询
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 完美版初中数学人教知识点
- 长亭一别相忘于江湖
- 北师大版初中数学视频教程
- 理解乘法分配律的巧妙之处
- 苏教版六年级语文上册教案设计
- 八年级物理学习策略
- 苏教版二年级下册数学期中测试卷详解剖析
- 数学苏教版小学顺口溜
- 苏教版数学解题转化策略的实际应用
- 温度对体育赛事的指导
- 08K132 金属、非金属风管支吊架
- 世界各国文化历史介绍-Brazil Information PowerPoint
- 中国知名集团绩效和薪酬管理诊断报告
- 第一讲 伟大事业都始于梦想(课件)
- 初中物理2022版新课程标准测试卷及答案
- 原油储罐盘管施工方案
- 配电室上墙的十项制度(3篇)
- 幼儿园图书目录
- 信息系统上线切换方案
- 扩大劳务分包招标文件
- 三角形全等的判定斜边直角边(优质课)获奖课件
评论
0/150
提交评论