数据库机房管理系统设计_第1页
数据库机房管理系统设计_第2页
数据库机房管理系统设计_第3页
数据库机房管理系统设计_第4页
数据库机房管理系统设计_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、数据库设计说明书姓名:学号:题目: 班级: 一、题目(42)机房管理系统l 实现机房信息、机器信息、学生信息、上机类型信息的管理;l 实现学生上机充值信息的管理;l 实现学生上机过程的登记、费用信息的管理;l 实现教学班及教学班学生信息的管理;l 实现上机费率标准的设置及教学班上机的预约,即设置各教学班的上课时段。l 创建存储过程统计各机房上机费用的统计;l 创建触发器实现费用登记时,自动修改该生的账户余额。l 建立各表之间的关系。二、需求分析针对一般高校机房管理系统的需求分析、通过对学生上机过程、教学班上机过程、注册过程、充值过程、的内容的数据流程分析一现设计如下数据项和数据结构(1)机房基

2、本信息:包括机房号、机房名、计算机数目、管理人等(2)计算机基本信息:包括计算机IP地址、编号、机房号、品牌、备注等(3)学生基本信息:包括学号、姓名、性名、行政班等(4)教学班基本信息:包括教学班班号、课程名称、课程性质、任课教师、教学班人数等(5)用户基本信息:包括用户名、学号、密码、余额等(6)学生充值基本信息:包括用户名、充值时间、金额、办理人等(7)机房收费标准基本信息:包括机房号、时间段、金额等(8)学生成绩基本信息:包括教学班号、学号、成绩等(9)教学班机房预约基本信息:包括机房号、上课时段、开始时间、结束时间、教学班号等(10)学生上机过程登记基本信息:包括计算机IP地址、日期

3、、上机时间、下机时间、学号、上机类型等(11)机房费用统计基本信息:包括计算机IP地址、日期、统计时间、费用等(12)收费人员基本信息:包括收费员编号、收费员姓名、性别、身份证号码、时间段等三、数据库概念结构设计1、系统功能结构图 图1 系统功能结构图2、局部E-R图图2 机房实体E-R图 图3 学生实体E-R图 图4 计算机实体E-R图图5 教学班实体E-R图3、全局E-R图图6 实体和实体之间关系E-R图四、数据库逻辑结构设计1、数据字典room(机房表) 字段名数据类型能否为空是否为主键说明rnoint否是机房号rnamechar(10)否否机房名numbersmallint能否计算机数

4、目managerchar(10)否否管理人computer(计算机表)字段名数据类型能否为空是否为主键说明IPchar(20)否是计算机IP地址cnosmallint否否编号rnoint否否机房号brandChar(20)能否品牌noteVarchar(100)能否备注Student(学生表)字段名数据类型能否为空是否作为主键说明snoInt否是学号snameChar(10)否否姓名sexChar(2)能否性别classChar(20)能否行政班Class(教学班表)字段名数据类型能否为空是否作为主键说明clnoint否是教学班号clnamechar(20)否否课程名称cltypeChar(2

5、0)否否课程类型teacherChar(10)否否任课教师clnumbersmallint能否教学班人数Usertable(用户表)字段名数据类型能否为空是否作为主键说明 unameChar(20)否是用户名snoint否否学号pwordChar(20)否否密码moneymoney能否余额Prepaid(充值表) 字段名数据类型能否为空是否作为主键说明 unameChar(20)否是用户名ptimedatetime否是充值时间pmoneysmallmoney否否金额transChar(10)否否收费人员Standard(收费标准表) 字段名数据类型能否为空是否作为主键说明rnoint否是机房号

6、stimeChar(20)否是时间段smoneysmallmoney否否金额/小时Result(成绩表)字段名数据类型能否为空是否作为主键说明 clnoint否是教学班号snoint否是学号resultfloat能否成绩Scheduled(教学班机房预定表)字段名数据类型能否为空是否作为主键说明 rnoint否是机房号timeChar(20)否是上课时段begintimesmalltime否否开始时间endtimesmalltime否否结束时间clnoint否否教学班号Record(上机过程登记表)字段名数据类型能否为空是否作为主键说明IPchar(20)否是计算机IP地址begintimed

7、atetime否是上机时间snoInt否否学号endtimedatetime能否下机时间typeChar(15)否否上机类型statistik (机房费用统计表) 字段名数据类型能否为空是否作为主键说明IPchar(20)否是计算机IP地址datesdatetime否是日期Snoint否否学号moneyssmallmoney否否费用2、关系图五、数据库实现1、创建数据库1、创建数据库create database roomon( name='room_data', filename='E:roomdataroom_data', size=1MB, maxsize

8、=3MB,filegrowth=1MB)log on( name='room_log', filename='E:roomlogroom_log', size=1MB, maxsize=3MB,filegrowth=1MB)2、创建表2、room(机房表)的创建create table room(rno int not null primary key,rname char(10) not null,number smallint null,manager char(10) not null)3、computer(计算机表)的创建create table com

9、puter(IP char(20) not null primary key,cno smallint not null ,rno int not null,brand char(20) null,note varchar(50) null)4、student(学生表)的创建create table student(sno int not null primary key,sname char(10) not null,sex char(2) null,class char(20) not null)5、class(教学班)的创建create table class(clno int not

10、null primary key,clname char(20) not null,cltype char(20) not null,teacher char(10) not null,clnumber smallint null)6、User(用户表)的创建create table usertable(uname char(20) not null primary key,sno int not null,pword char(20) not null,moneys money null,)7、prepaid(充值表)的创建 create table prepaid(uname char(2

11、0) not null,ptime datetime not null,pmoney smallmoney not null,trans char(10) not null,constraint p_primary primary key(uname,ptime)8、standard(收费标准表)的创建create table standard(rno int not null,stime char(20) not null,smoney smallmoney not null,constraint c_primary primary key(rno,stime)9、result(成绩表)的创

12、建create table result(clno int not null,sno int not null,result float null,constraint r_prinary primary key(clno,sno)10、scheduled(教学班机房预定表)的创建create table scheduled(clno int not null,rno int not null,stime char(20) not null,begintime datetime not null,endtime datetime not null,constraint s_primary pr

13、imary key(rno,stime)11、record(上机过程登记表)的创建create table record(IP char(20) not null,sno int not null,begintime datetime not null,endtime datetime null,type char(15) not null,constraint t1 primary key(IP,begintime)12、statistik(费用统计表)的创建create table statistik(IP char(20) not null,dates datetime not null

14、,sno int not null,moneys smallmoney not null,constraint t2 primary key(IP,dates)2、创建存储过程和触发器1、 创建存储过程实现各机房上机费用的统计1)代码create proc s_room(rno int)asselect rname 机房名,sum(moneys) 费用 from statistik inner join computeron computer.IP=statistik.IP inner join room on room.rno=computer.rnowhere room.rno=rnogr

15、oup by rname2)数据测试exec s_room 5142、创建触发器实现费用登记时,自动修改该生的账户余额。1)代码create trigger u_money on statistikfor insertasupdate usertableset moneys=moneys-(select moneys from inserted)where sno=(select sno from inserted)2)数据测试查询插入记录前学生的余额select sno 学号,moneys 余额from usertablewhere sno=101执行插入操作insert into stat

16、istikvalues('321-458-984',getdate(),101,3.5)查询插入记录前学生的余额select sno 学号,moneys 余额from usertablewhere sno=1012、 创建触发器实现充值时自动修改该生余额1)代码create trigger un_money on prepaidfor insertasupdate usertableset moneys=moneys+(select pmoney from inserted)where uname=(select uname from inserted)2)数据测试select

17、 sno 学号,moneys 余额 from usertablewhere sno=102goinsert into prepaidvalues('bbb',getdate(),4.8,'王俊')goselect sno 学号,moneys 余额 from usertablewhere sno=102goselect * from prepaid六、结束语通过这次课程设计,我更加熟练的掌握了数据库设计的方法,加深了对数据库课程知识的理解,同时也更加深入的了解了利用SQL语言操纵数据库的知识,并且对数据库里面的存储过程有了比较深入的了解。经过几天的艰苦奋斗,我终于完成了我的数据库课程设计基于DB2的列车票务管理系统。进一步提高分析解决问题的综合能力。由于时间仓促,系统还有很多不足之处,所以开发的系统不是很完善,有一些功能

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论