收藏 分销(赏)

机房标准管理系统数据库设计.doc

上传人:快乐****生活 文档编号:2495324 上传时间:2024-05-30 格式:DOC 页数:14 大小:184.54KB
下载 相关 举报
机房标准管理系统数据库设计.doc_第1页
第1页 / 共14页
机房标准管理系统数据库设计.doc_第2页
第2页 / 共14页
机房标准管理系统数据库设计.doc_第3页
第3页 / 共14页
机房标准管理系统数据库设计.doc_第4页
第4页 / 共14页
机房标准管理系统数据库设计.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

1、学院机房管理系统 数据库设计阐明书设计人: 学号: 班级: 学院: 目录一、需求分析1.业务流程图2.数据流图3.数据字典二、概念设计1、实体属性图2、全局E-R图三、逻辑设计1、表间关系图2、关系模式四、数据库实现1、创立数据库2、创立表2、创立存储过程和触发器一、需求分析针对普通高校机房管理系统需求分析、通过对学生上机过程、教学班上机过程、注册过程、充值过程、内容数据流程分析一现设计如下数据项和数据构造(1)机房基本信息:涉及机房号、机房名、计算机数目、管理人等(2)计算机基本信息:涉及计算机IP地址、编号、机房号、品牌、备注等(3)学生基本信息:涉及学号、姓名、性名、行政班等(4)顾客基

2、本信息:涉及顾客名、学号、密码、余额等(5)学生充值基本信息:涉及顾客名、充值时间、金额、办理人等(6)机房收费原则基本信息:涉及机房号、金额等(7)学生上机过程登记基本信息:涉及计算机IP地址、日期、上机时间、下机时间、学号、上机类型等(8)机房费用记录基本信息:涉及计算机IP地址、日期、记录时间、费用等 1.业务流程图 2.数据流图3.数据字典room(机房表) 字段名数据类型能否为空与否为主键阐明rnoint否是机房号rnamechar(10)否否机房名numbersmallint能否计算机数目managerchar(10)否否管理人computer(计算机表)字段名数据类型能否为空与否

3、为主键阐明IPchar(20)否是计算机IP地址cnosmallint否否编号rnoint否否机房号brandChar(20)能否品牌noteVarchar(100)能否备注Student(学生表)字段名数据类型能否为空与否作为主键阐明snoInt否是学号snameChar(10)否否姓名sexChar(2)能否性别classChar(20)能否行政班Usertable(顾客表)字段名数据类型能否为空与否作为主键阐明 unameChar(20)否是顾客名snoint否否学号pwordChar(20)否否密码moneymoney能否余额Prepaid(充值表) 字段名数据类型能否为空与否作为主键

4、阐明 unameChar(20)否是顾客名ptimedatetime否是充值时间pmoneysmallmoney否否金额transChar(10)否否收费人员Standard(收费原则表) 字段名数据类型能否为空与否作为主键阐明rnoint否是机房号stimeChar(20)否是时间段smoneysmallmoney否否金额/小时Record(上机过程登记表)字段名数据类型能否为空与否作为主键阐明IPchar(20)否是计算机IP地址begintimedatetime否是上机时间snoInt否否学号endtimedatetime能否下机时间typeChar(15)否否上机类型statistik

5、 (机房费用登记表) 字段名数据类型能否为空与否作为主键阐明IPchar(20)否是计算机IP地址datesdatetime否是日期Snoint否否学号moneyssmallmoney否否费用二、概念设计1、实体属性图机房机器数目机房号机房名管理人学生行政班学号姓名性别图一 机房实体E-R图 图二 学生实体E-R图2、全局E-R图机房顾客学生计算机机房号机房名机器数目管理人编号机房号品牌备注行政班学号性别姓名余额密码学号顾客名属于上机选取属于n1111n11计算机ID三、逻辑设计1、表间关系图 2、关系模式机房(机房号,机房名,机器数目,管理人)学生(学号,姓名,性别,行政班)计算机(编号,机

6、房号,品牌,备注)顾客(顾客名,学号,密码,余额)四、数据库实现1、创立数据库1、创立数据库create database roomon( name=room_data, filename=E:roomdataroom_data, size=5MB, maxsize=10MB,filegrowth=1MB)log on( name=room_log, filename=E:roomlogroom_log, size=5MB, maxsize=10MB,filegrowth=1MB)2、创立表2、room(机房表)创立create table room(rno int not null prim

7、ary key,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)4、student(学生表)创立create table student(sno int not null primary key,

8、sname char(10) not null,sex char(2) null,class char(20) not 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(20) not null,ptime datetime not null,pmoney smallmoney

9、 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)11、record(上机过程登记表)创立create table record(IP char(20) not null,sno int

10、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,sno int not null,moneys smallmoney not null,constraint t2 primary key(IP,dates)2、创立存储过程和触发

11、器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=rnogroup by rname2、创立触发器实现费用登记时,自动修改该生账户余额。1)代码create trigger u_money on statistikfor insertasupd

12、ate usertableset moneys=moneys-(select moneys from inserted)where sno=(select sno from inserted)2)数据测试查询插入记录前学生余额select sno 学号,moneys 余额from usertablewhere sno=508092执行插入操作insert into statistikvalues(001,getdate(),101,2.5)查询插入记录学生余额select sno 学号,moneys 余额from usertablewhere sno=5080923.创立触发器实现充值时自动修

13、改该生余额1)代码create trigger un_money on prepaidfor insertasupdate usertableset moneys=moneys+(select pmoney from inserted)where uname=(select uname from inserted)2)数据测试select sno 学号,moneys 余额 from usertablewhere sno=508092goinsert into prepaidvalues(bbb,getdate(),5,个vga )goselect sno 学号,moneys 余额 from usertablewhere sno=508092goselect * from prepaid

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 通信科技 > 数据库/数据算法

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服