数据库+机房管理系统设计

上传人:飞*** 文档编号:5453448 上传时间:2017-08-30 格式:DOC 页数:13 大小:201.50KB
返回 下载 相关 举报
数据库+机房管理系统设计_第1页
第1页 / 共13页
数据库+机房管理系统设计_第2页
第2页 / 共13页
数据库+机房管理系统设计_第3页
第3页 / 共13页
数据库+机房管理系统设计_第4页
第4页 / 共13页
数据库+机房管理系统设计_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《数据库+机房管理系统设计》由会员分享,可在线阅读,更多相关《数据库+机房管理系统设计(13页珍藏版)》请在金锄头文库上搜索。

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

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

3、上机时间、下机时间、学号、上机类型等(11)机房费用统计基本信息:包括计算机 IP 地址、日期、统计时间、费用等(12)收费人员基本信息:包括收费员编号、收费员姓名、性别、身份证号码、时间段等三、数据库概念结构设计1、系统功能结构图3上上上上上上上上上上上上上上上上上上上上上上上上上上上上上上上 上上上上图 1 系统功能结构图2、局部 E-R 图上上上上上 上上上上上图 2 机房实体 E-R 图 图 3 学生实体 E-R 图上上ID上上上上4图 4 计算机实体 E-R 图上上上上上上图 5 教学班实体 E-R 图3、全局 E-R 图机 房机 器 数 目机 房 号 机 房 号 机 房 号 学 生

4、行 政 班学 号姓 名 性 别计 算 机 计 算 机 ID编 号 机 房 号 品 牌 备 注教 学 班班 级 号 课 程 性 质 课 程 名 称任 课 教 师班 级 人 数属 于选 课上课 上机NMNN图 6 实体和实体之间关系 E-R 图5四、数据库逻辑结构设计1、数据字典room(机房表) 字段名 数据类型 能否为空 是否为主键 说明rno int 否 是 机房号rname char(10) 否 否 机房名number smallint 能 否 计算机数目manager char(10) 否 否 管理人computer(计算机表 )字段名 数据类型 能否为空 是否为主键 说明IP char

5、(20) 否 是 计算机 IP 地址cno smallint 否 否 编号rno int 否 否 机房号brand Char(20) 能 否 品牌note Varchar(100) 能 否 备注Student(学生表)字段名 数据类型 能否为空 是否作为主键 说明sno Int 否 是 学号sname Char(10) 否 否 姓名sex Char(2) 能 否 性别class Char(20) 能 否 行政班Class(教学班表)字段名 数据类型 能否为空 是否作为主键 说明clno int 否 是 教学班号clname char(20) 否 否 课程名称cltype Char(20) 否

6、否 课程类型teacher Char(10) 否 否 任课教师clnumber smallint 能 否 教学班人数Usertable(用户表 )字段名 数据类型 能否为空 是否作为主键 说明 uname Char(20) 否 是 用户名sno int 否 否 学号pword Char(20) 否 否 密码money money 能 否 余额6Prepaid(充值表) 字段名 数据类型 能否为空 是否作为主键 说明 uname Char(20) 否 是 用户名ptime datetime 否 是 充值时间pmoney smallmoney 否 否 金额trans Char(10) 否 否 收费

7、人员Standard(收费标准表) 字段名 数据类型 能否为空 是否作为主键 说明rno int 否 是 机房号stime Char(20) 否 是 时间段smoney smallmoney 否 否 金额/小时Result(成绩表)字段名 数据类型 能否为空 是否作为主键 说明 clno int 否 是 教学班号sno int 否 是 学号result float 能 否 成绩Scheduled(教学班机房预定表)字段名 数据类型 能否为空 是否作为主键 说明 rno int 否 是 机房号time Char(20) 否 是 上课时段begintime smalltime 否 否 开始时间en

8、dtime smalltime 否 否 结束时间clno int 否 否 教学班号Record(上机过程登记表)字段名 数据类型 能否为空 是否作为主键 说明IP char(20) 否 是 计算机 IP 地址begintime datetime 否 是 上机时间sno Int 否 否 学号endtime datetime 能 否 下机时间type Char(15) 否 否 上机类型7statistik (机房费用统计表) 字段名 数据类型 能否为空 是否作为主键 说明IP char(20) 否 是 计算机 IP 地址dates datetime 否 是 日期Sno int 否 否 学号mone

9、ys smallmoney 否 否 费用2、关系图五、数据库实现81、创建数据库1、创建数据库create database roomon( name=room_data,filename=E:roomdataroom_data,size=1MB,maxsize=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 ke

10、y,rname char(10) not null,number smallint null,manager char(10) not null)3、computer(计算机表)的创建create table computer(IP char(20) not null primary key,cno smallint not null ,rno int not null,brand char(20) null,note varchar(50) null)94、student(学生表) 的创建create table student(sno int not null primary key,sn

11、ame char(10) not null,sex char(2) null,class char(20) not null)5、class( 教学班) 的创建create table class(clno int not 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

12、,sno int not null,pword char(20) not null,moneys money null,)7、prepaid( 充值表)的创建 create table prepaid(uname char(20) 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(10rno int not

13、 null,stime char(20) not null,smoney smallmoney not null,constraint c_primary primary key(rno,stime)9、result(成绩表)的创建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

14、 int not null,stime char(20) not null,begintime datetime not null,endtime datetime not null,constraint s_primary primary 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

15、 primary key(IP,begintime)12、statistik(费用统计表)的创建create table statistik(11IP char(20) not null,dates datetime not null,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

16、statistik inner join computeron computer.IP=statistik.IP inner join room on room.rno=computer.rnowhere room.rno=rnogroup 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 sn

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 企业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号