为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

实例3:高校学生会管理系统数据库设计

2017-10-15 50页 doc 1MB 43阅读

用户头像

is_014457

暂无简介

举报
实例3:高校学生会管理系统数据库设计实例3:高校学生会管理系统数据库设计 实例3:高校学生会管理系统数据库设计 practices. The development of various undertakings, requires each party to pay and hard work. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party members. Both ...
实例3:高校学生会管理系统数据库设计
实例3:高校学生会管理系统数据库 实例3:高校学生会管理系统数据库设计 practices. The development of various undertakings, requires each party to pay and hard work. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party members. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to perform good decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus on improving service, the ability 1数据库设计 1.1系统需求分析阶段 需求分析简单的说就是分析用户的要求。需求分析是涉及数据库的起点,需求分析的结果是否准确地反映了用户的实际要求,将直接影响到后面各个阶段的设计,并影响到设计的结果是否合理和实用。 1.1.1 需求分析阶段的目标 1(了解高校学生会管理的基本内容; 2(综合的理解主管学生会老师和学生会干部的不同需求; 3(了解学生会管理的基本业务流程; 4(了解学生会人工管理模式与信息系统的工作概况,以及它们之间的区别与联系; 5( 通过自身的体验和与主管学生会的老师及其他学生会干部的交流,了解用户对高校学生会管理系统的业务要求,完整性和安全性要求。 1.1.2 需求分析阶段的任务 1(处理对象: 系统处理对象是学生会的干部信息管理、财务管理、日常事务管理和文件信息管理四个方面。 在学生会的干部信息处理中主要涉及几下几个方面的信息: (1)学生会干部基本信息(Student):包括编号、姓名、性别、职务、专业、、加入学生会日期、参加过的活动项目等信息。 (2)部门基本信息(Dpartment):部门编号、部门名称、部长姓名、副部长人数、部委人数、部长电话等信息。 在财务信息处理中主要涉及几下几个方面的信息: (1)物品基本信息(Goods):包括物品编号、物品名称、购买时间、单价、借出时间,借物人姓名、归还时间、归还人姓名等信息。 (2)财务基本信息(Financial affairs):包括财务申请编号、资金用途、申请金额、申请人、申请部门、申请时间、余额等信息。 在日常事务信息处理中主要涉及几下几个方面的信息: (1)事务活动基本信息(Affairs):包括事务活动编号、事务活动名称、职能范围、承办部门、以往解决、是否特色活动等信息。 (2)工作基本信息(Working plan):包括工作计划编号、工作计划名称、提交部门、提交人、提交时间、是否紧急活动等信息。 在文件信息处理中主要涉文件的基本信息(File):包括文件编号、文件名称、文件类 -1- 型、所属部门、负责人、收发对象、存档日期、备注等信息。 2(处理功能要求 高校学生会管理系统主要实现对学生会的科学化、条理化、信息化、高效化管理。其中包括学生会干部信息、财产物品的使用以及登记,日常事务管理和文件信息管理等四大功能。具体功能描述如下: (1)学生会干部信息管理主要完成干部信息的查询与更新,从而实现对学生会干部信息的科学化管理。 (2)财务的管理包括财产和物品的管理,完成对财产物品信息的查询与更新,如举办活动所需的资金申请、物品使用的登记、物品借还的登记等,从而实现学生会财务的信息化管理。 (3)日常事务管理实现对学生会日常开展工作的管理,完成日常事务的查询与更新,从而更好地实现以下职能:包括各部门提交的工作计划、活动计划的审核与安排、活动的筹划、各项活动的人员合理的调度与安排,确保各项活动成功地举办,更有利于学生会各项日常工作的顺利开展。 (4)文件管理完成对学生会所有存档文件的查询与更新,实现对学生会日常的工作文件的科学化管理,从而确保各项工作的开展有章可寻,使学生会的工作更富有条理化,避免一些重复文件的制定,造成资源的浪费。 3(安全性和完整性要求 安全性先通过视图机制,不同的用户只能访问系统授权的视图,这样可提供系统数据一定程度上的安全性,再通过用户授权机制,通过用户登陆来识别用户级别,根据这个级别来分配用户权限,达到数据更高层次的安全保密功能。近而可以满足用户的基本数据安全性要求。 完整性要求用于描述各种信息之间的制约关系,以及关联关系,各个数据项的取值范围以及各个数据项是否可以不取值。根据实际需要,采取一定的手段来满足用户的完整性需求。详细完整性要求见于系统的逻辑设计阶段。 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 2 4(业务流程图 学生会干部信息管理业务流程图: 财务管理业务流程图: -3- 日常事务管理业务流程图: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 4 文件管理业务流程图: 5(数据流程图 -5- 顶层数据流程图: 第2层数据流程图: 第3层数据流程图:从学生干部信息管理角度出发 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 6 第3层数据流程图:从财务管理角度出发 第3层数据流程图:从日常事务管理角度出发 -7- 第3层数据流程图:从文件管理角度出发 7(数据字典 (1)数据项:系统涉及的数据项有51项 表1.1(高校学生会管理系统)数据项列表(汇总统计) 数据项编号 数据项名 数据项含义 与其它数据项的关系 存储结构 别名 DI-1 StuNo 学生干部编号 char(8) 编号 DI-2 StuName 学生干部姓名 char(10) 姓名 DI-3 StuSex 学生干部性别 char(2) 性别 DI-4 StuPosition 学生干部职务 char(6) 职务 DI-5 StuDepartName 学生干部所属部门 等于DepNo char(6) 部门 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 8 数据项编号 数据项名 数据项含义 与其它数据项的关系 存储结构 别名 DI-6 StuMajor 学生干部所属专业 char(20) 专业 DI-7 StuGrade 学生干部所在年级 char(8) 年级 DI-8 StuPhoneNo 学生干部电话 char(12) 电话 DI-9 StuStaTime 加入学生会时间 datetime 时间 DI-10 StuCase 参加过的活动项目 varchar(50) 项目 DI-11 GoodsNo 物品编号 char(8) 编号 DI-12 GoodsName 物品名称 char(16) 名称 DI-13 GoodsBuyTime 购买时间 datetime 时间 DI-14 GoodsPrice 单价 char(6) 单价 DI-15 GoodsLendTime 借出时间 datetime 时间 DI-16 GoodsLender 借物人姓名 char(10) 姓名 DI-17 GoodsReturner 归还人姓名 char(10) 姓名 DI-18 GoodsRetTime 归还时间 datetime 时间 DI-19 FinNo 财务申请编号 char(6) 编号 DI-20 FinPurpose 用途 char(30) 用途 DI-21 FinMoney 申请金额 char(6) 金额 DI-22 FinPerson 申请人姓名 char(10) 姓名 DI-23 FinDepartment 申请部门 char(14) 部门 DI-24 FinTime 申请时间 datetime 时间 DI-25 FinRemain 余额 char(6) 余额 DI-26 PlaNo 工作计划编号 等于FileNo char(6) 编号 DI-27 PlaName 工作计划名称 char(30) 名称 DI-28 PlaDepartment 计划提交部门 等于DepNo char(6) 部门 DI-29 PlaPerson 计划提交人 char(10) 姓名 DI-30 PlaTime 计划提交时间 datetime 时间 DI-31 PlaQuality 是否紧急活动 char(4) 是否 DI-32 AffNo 事务活动编号 char(6) 编号 DI-33 AffName 事务活动名称 char(20) 名称 职能 DI-34 AffScope 事务活动职能范围 char(8) 范围 DI-35 AffDepartment 主要承办部门 等于DepNo char(6) 部门 DI-36 AffScheme 以往解决方案 char(50) 方案 DI-37 AffQuality 是否特色活动 char(4) 活动 DI-38 DepNo 部门编号 char(6) 编号 DI-39 DepName 部门名称 char(14) 名称 DI-40 DepMinName 部长姓名 等于StuName char(8) 姓名 DI-41 DepSminSum 副部长人数 int 人数 DI-42 DepMemSum 部委人数 int 人数 DI-43 MinPhoNo 部长电话 char(12) 电话 -9- 数据项编号 数据项名 数据项含义 与其它数据项的关系 存储结构 别名 DI-44 FilesNo 文件编号 char(6) 编号 DI-45 FilesName 文件名称 char(20) 名称 DI-46 FilesType 文件类型 char(14) 类型 DI-47 FilesBelDep 所属部门 char(6) 部门 DI-48 FilesPerson 负责人 char(8) 姓名 DI-49 RecDisPartner 收发对象 char(14) 对象 DI-50 ArcDate 存档日期 datetime 日期DI-51 Remarks 备注 char(30) 备注 (2)数据结构: 表1-2 (高校学生会管理系统) 数据结构(汇总统计) 数据结构编号 数据结构名 数据结构含义 组成 StuNo,StuName,StuSex,StuPosition,StuMajor, DS-1 Student 学生干部信息 StuDepartName,StuGrade,StuPhoneNo,StuCase, StuStaTime, GoodsNo,GoodsName,GoodsBuyTime,GoodsPric,GoodDS-2 Goods 物品信息 sLender,GoodsLendTime,GoodsReturner, GoodsRetTime FinNo, FinPurpose, FinMoney, FinPerson, DS-3 FinancialAffairs 财务信息 FinTime,FinDepartment, FinRemain PlaNo, PlaName, PlaDepartment, PlaPerson DS-4 WorkingPlan 工作计划信息 PlaTime, PlaQuality AffNo, AffName, AffScope, AffDepartment DS-5 Affairs 事务活动信息 AffScheme, AffQuality DepNo,DepName,DepMinName, DepSminSum DS-6 Department 部门信息 DepMemSum, MinPhoNo FilesNo,FilesName,FileTyp,FilesBelDep, DS-7 Files 文件信息 FilesPerson, RecDisPartner, ArcDate, Remarks on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 10 8(处理逻辑描述(判定表或判定树) 表1-3 (高校学生会管理系统)处理逻辑描述 处理编号 处理功能 处理过程 学生会干部信息管理模块、财务管理模块、学生 会日常事务管理模块、文件信息管理模块:先确PR-1 判断用户查询涉及的功能模块 定查询所涉及的功能模块;然后,确定要查询的 内容,确定查询数据流向;最后显示查询结果。 学生会干部信息管理模块、财务管理模块、学生判断用户修改要涉及的模块,同会日常事务管理模块、文件信息管理模块:先确PR-2 时把相应的修改数据传到相应的定更新所涉及的功能模块;然后,把更新信息传模块之中 送到相应的模块中;最后,进行相应的更新操作。 1.2 概念设计阶段 1.2.1 目标 将需求分析得到用户需求抽象为信息结构即概念模型的过程就是概念结构设计。概念设计阶段主要是将需求分析阶段得到的用户需求抽象为信息结构(概念模型)的过程,它是整个数据库设计的关键,包括概念模型设计和新系统流程两个阶段。在需求分析阶段所得到的应用需求应该首先抽象为信息世界的结构,才能更好地、更准确地用某一DBMS实现这些需求。 1.2.2 具体任务 1(选择中层数据流为切入点,通常选择实际系统中的子系统; 2(设计分E-R图,即各子模块的E-R图; 3(生成初步E-R图,通过合并方法,做到各子系统实体、属性、联系统一; 4(生成全局E-R图,消除冲突。 1.2.3 结果 1(各实体及其属性 -11- on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 12 2(生成分E-R图如下所示: -13- 3(合并各分,,,图,消除各类冲突,得到初步E-R图,再消除不必要冗余,得到的基本E-R图。具体实现如下: a.消除冲突 合并分E-R图时并不能简单地将各个分E-R图画到一起,而是必须着力消除各个分E-R图中的不一致,以形成一个能为全系统中所有的用户共同理解和接受的统一的概念模型。合并分E-R图的主要工作与关键是合理消除各分E-R图的冲突,冲突主要有三类:属性冲突、命名冲突和结构冲突。 b.消除冗余 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 14 在E-R 图中,可能存在一些冗余的数据和实体间的联系。冗余数据和冗余联系容易破坏数据库的完整性,给数据库的维护增加困难,应予以消除。但并不是所有的冗余数据与冗余联系都必须加以消除,有时为了提高效率,不得不以冗余信息作为代价。消除冗余主要采用分析法和规范化理论。 经过以上分析,将所有的分E-R图综合成一个系统的总E-R图: 解释如下: 一个部门可以承办多个事务活动,而一个事务活动只能由一个部门去承办; 一个部门可以包括多个学生会干部,而一个学生会干部只能隶属于一个部门; 一个学生会干部可以参与多项事务活动,而一个事务活动也可以有多个学生干部参与; 一个学生会干部可以提交多份财务申请,而一份财务只能由一个学生会干部申请; 一个学生会干部可以制定多份文件,而一份文件只能由一个学生会干部制定; 一个学生会干部可以提交多份工作计划,而一份工作计划只能由一个学生会干部提交; 一份财务申请的资金可以购买多种物品,而一种物品只能由一次财务申请的资金来购买; 一次事务活动需借用多种物品,而一种物品一次只能给被一项事务活动所借用; 一份工作计划可以包括多项事务活动,而一项事务活动只能有一份工作计划中制定。 4(新系统流程图 -15- 1.3逻辑设计阶段 1.3.1逻辑设计阶段的目标 以上的概念设计阶段是独立于任何一种数据模型的,但是逻辑设计阶段就与选用的DBMS产品发生关系了,系统逻辑设计的目标就是将概念设计阶段设计好的基本E-R图转换为选用DBMS产品所支持的数据模型相符合的逻辑结构。 1.3.2逻辑设计阶段的任务 具体任务是数据组织和数据处理。在数据组织阶段主要要完成的任务是将E-R图转换成为关系模型;模型优化;完成数据库模式定义描述,包括各模式的逻辑结构定义、关系的完整性和安全性等内容;用户子模式设计。以表格的形式表现出来。数据处理阶段主要任务是画出系统功能模块图。 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 16 1(数据组织 (1)实体型转换为关系模式 一个实体型转换为一个关系模式。实体的属性就是关系的属性,实体的码就是关系的码。 学生会干部(编号,姓名,性别,职务,部门,专业,年级,电话,加入学生会日期,参加过的活动项目) 物品(编号,名称,购买时间,单价,借出时间,借物人姓名,归还时间,归还人姓名) 财务(财务申请编号,资金用途,申请金额,申请人,申请部门,申请时间,余额) 工作计划(编号,名称,提交部门编号,提交人,提交时间,是否紧急活动) 事务活动(编号,名称,职能范围,承办部门,以往解决方案,是否特色活动) 部门(部门编号,部门名称,部长编号,副部长人数,部委人数,部长电话) 文件(编号,名称,类型,所属部门编号,负责人,收发对象,存档日期,备注) (2)实体间联系转换为关系模式 一个1:1联系可以转换为一个独立的关系,也可以与任意一段对应的关系模式合并。如果转化为一个独立的关系模式,则与该联系相连的各个实体的码以及联系本身的属性均转换为关系的属性,每个实体的码均是该关系的候选码。如果与某一个实体对应的关系合并,则需要在该关系模式的属性中加入另一个关系的主码和联系本身的属性。 一个m:n的联系可以转化为一个单独的关系模式,这个单独的关系模式的主码事两端实体的码,再加上联系的属性。 一个1:n联系可以转化为一个独立的关系模式,也可以与n端的关系模式合并作如果与n端的关系模式合并,在n端的关系模式中加上另一端关系的码和联系属性。 为了方便系统地实现和数据库的设计,将所有的关系均作为一个单独的关系模式。 (3)通过转化后所得出的关系模型 在以下的关系模式当中,关系模式的码用直下划线标出,关系模式的外键用曲下划线标出。 学生会干部(编号,姓名,性别,职务,部门,专业,年级,电话,加入学生会日期,参加过的活动项目) 物品(编号,财务申请编号,名称,购买时间,单价,借出时间,借物人姓名,归还时间,归还人姓名) 财务(财务申请编号,资金用途,申请金额,申请人,申请部门,申请时间,余额) 工作计划(编号,名称,提交部门编号,提交人,提交时间,是否紧急活动) 事务活动(编号,名称,职能范围,承办部门,以往解决方案,是否特色活动) 部门(编号,名称,部长编号,副部长人数,部委人数,部长电话) 文件(编号,名称,类型,所属部门编号,负责人,收发对象,存档日期,备注) 活动使用物品(事务活动编号,物品编号,使用数量) 参与活动(事务活动编号,学生会干部编号,出勤情况) (4)数据模型优化 经过检查,以上九个关系模型当中前七个的主码都只有一个属性列,所以不从在部分函数依赖,后两个关系模式也不存在部分函数依赖。而且这九个关系模式也不存在传递函 -17- 数依赖。因此,它们均已经达到3NF。 (5)数据库模式定义 其中,包括各模式的逻辑结构定义、关系的完整性和安全性等内容。一个关系模式应当是一个五元组R< U, D, dom, F >,而一般只将其看作一个三元组R。 表2.1 数据库模式定义表 编号 逻辑结构(基本表)定义 完整性和安全性 T,1 Student(详见附录2,1) (详见附录2,1) T,2 Goods(详见附录2,2) (详见附录2,2) T,3 FinancialAffairs(详见附录2,3) (详见附录2,3) T,4 WorkingPlan(详见附录2,4) (详见附录2,4) T,5 Affairs(详见附录2,5) (详见附录2,5) T,6 Department(详见附录2,6) (详见附录2,6) T,7 Files(详见附录2,7) (详见附录2,7) T,8 AffairsGoods(详见附录2,8) (详见附录2,8) T,9 JoinAffairs(详见附录2,9) (详见附录2,9) (6)用户子模式设计 将概念模型转换为全局逻辑模型后,还应该根据用户的习惯和需求设计符合局部用户需要的外模式,即视图设计。 表2.2 用户子模式设计(View)列表 编号 用户子模式(View) 作用(共性:提供数据保密和安全保护机制) V,1 StuView 查询和修改学生会干部的基本信息 V,2 DepView 查询和修改各部门的基本信息 V,3 GooView 查看物品的借出和归还信息 V,4 FinView 查看活动经费使用情况 V,5 WPView 查看工作计划提交的情况 V,6 AffView 查看以往事务活动方案以供来参看 V,7 FilesView 查看以前存档文件的基本信息 V,8 AGView 查询举办活动物品的使用情况 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 18 2(数据处理 系统功能模块图: 1.4物理设计阶段 1.4.1物理设计阶段的目标 不同的数据库产品所提供的物理存储环境、存取方法和存储结构有很大的差别,能供设计人员设用的设计变量、参数范围也很不相同。物理设计阶段的目标是根据SQL Server2000具体的功能,设计优化的物理数据库结构,使得在数据库上运行的各种事务响应时间最小,存储空间利用率高,事务吞吐量大。 1.4.2物理设计阶段的任务 紧数据库的物理设计就是为逻辑数据模型选取一个最合适应用要求的物理结构的过程,在这个阶段中要完成两大任务: (1)确定数据库的物理结构,在关系数据库中主要是存取方法和存储结构; (2)对物理结构进行评价,评价的重点是时间和空间效率。 1(数据存储方面 为数据库中各基本表建立的索引如下: (1)由于基本表Student、Goods、Affairs、Dpartment的主码StuNo、GoodsNo、AffNo、DepNo经常在查询条件和连接操作的连接条件中出现,且它们的值唯一,考虑在两个属性上建立唯一性索引; -19- (2)AffairsGoods的主码AffNo和StuNo,JoinAffairs的主码AffNo和StuNo,他们经常在查询条件中出现,且它们的组合值唯一,考虑在它们之上建立组合索引; (3)基本表Financial affairs、Working plan的属性值几乎不会有什么变化,更新率很低,可考虑适当建立索引; (4)基本表File的属性值经常发生变化,权衡系统为维护索引付出的代价,可考虑不建立索引,也可以适当建立索引。 2(系统功能模块 (1)学生会干部信息查询和更新模块 将实现对学生会干部信息的查询和更新(修改、插入、删除)操作,方便于对学生干部基本信息的全面、科学的管理,能有效的应对学生会干部的变动性和流动性,及时地更换信息。具体的功能模块图如下: (2)财务信息的查询和更新模块 将完成财产和物品基本信息的查询、更新(修改、插入、删除)操作,便于对财产物品的集中管理,从而更有利于节约举办活动的开支,确保学生会各项工作顺利的开展。具体的功能模块图如下所示: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 20 (3)日常事务信息的查询和更新模块 将达到对日常事务信息的查询、更新(修改、插入、删除)操作的目的,从而实现将学生会的日常事务纳入信息化的管理当中,在日常工作开展中可以有效地节约人力、物力、财力,减少重复性工作的复杂性,更有利于创建一个科学、高效、高水平的学生会。具体的功能模块图如下所示: -21- (4)文件基本信息的查询和更新模块 将完成对文件信息的查询和插入、删除、修改等更新操作,从而实现对学生会所有文件的科学化管理,便于日常工作的开展。具体的功能模块如下所示: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 22 1.4.3物理设计阶段结果 表4-1 存储过程汇总 编号 存储过程名称 定义 作用 P-1 p1_ Student _Insert 详见附录2-1 在Student中插入一元组 P-2 p2_ Goods _Insert 详见附录2-2 在Goods中插入一元组 P-3 p3_ FinancialAffairs _Insert 详见附录2-3 在FinancialAffairs中插入一元组 P-4 p4_ WorkingPlan _Insert 详见附录2-4 在WorkingPlan中插入一元组 P-5 p5_ Affairs _Insert 详见附录2-5 在Affairs中插入一元组 P-6 p6_ Dpartment _Insert 详见附录2-6 在Dpartment中插入一元组 P-7 p7_ File _Insert 详见附录2-7 在File中插入一元组 P-8 p8_ AffairsGoods _Insert 详见附录2-8 在AffairsGoods中插入一元组 P-9 p9_ JoinAffairs _Insert 详见附录2-9 在JoinAffairs中插入一元组 P-10 P10_Query_Department 详见附录2-10 在Department中匹配(DepNo)查询 P-11 P11_Query_Department 详见附录2-11 在Department中匹配(DepName)查询 P-12 P12_Delete_Department 详见附录2-12 在Department中删除元组 P-13 P13_Update_Department 详见附录2-13 在Department中更新操作 (其他表的查询、修改、删除与Department表的大致相同,这里不再具体列出) -23- 1.5数据库实施阶段 1.5.1数据库实施阶段目标 用DBMS所提供的数据定义语言和其他实用程序将数据库逻辑设计和物理设计结果描述出来,成为DBMS可以接受的源代码,在经过调试生成目标模式 1.5.2数据库实施阶段任务 1(建立数据库 create database University_Student_Union_Management; 2(建立数据表 (1)学生会干部基本信息表的建立 create table Student( StuNo char(8) not null unique, StuName char(10) not null, StuPosition char(6) not null, StuSex char(2) null, StuMajor char(14) null, StuDepart char(6) not null, StuGrade char(8) null, StuPhoneNo char(12) not null, StuStaTime datetime not null, StuCase varchar(50) null, primary key(StuNo), foreign key(StuDepart) references Department(DepNo), check(StuSex = ‘男’ or StuSex = ‘女’)); (2)物品基本信息表的建立 create table Goods( GoodsNo char(8) not null unique, FinNo char(6) not null, GoodsName char(16) not null, GoodsBuyTime datetime null, GoodsPrice char(6) not null, GoodsLender char(10) not null, GoodsLendTime datetime null, GoodsReturner char(10) not null, GoodsRetTime datetime null, primary key (GoodsNo), on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 24 foreign key (FinNo) references FinancialAffairs (FinNo)); (3)财务基本信息表的建立: create table FinancialAffairs ( FinNo char(16) not null unique, FinPurpose char(30) null, FinMoney char(6) not null, FinPerson char(8) not null, FinTime datetime null FinDepartment char(6) not null FinRemain char(6) null primary key(FinNo), foreign key (FinPerson) references Student(StuNo), foreign key (FinDepartment) references Department(DepNo)); (4)工组计划基本信息表的建立: create table WorkingPlan( PlaNo char(6) not null unique, PlaName char(30) not null, PlaDepartment char(6) not null, PlaPerson char(8) null, PlaTime Datetime null, PlaQuality char(4) not null, primary key(PlaNo), foreign key(PlaPerson) references Student(StuNo), foreign key(PlaDepartment ) references Department(DepNo)); (5)事务活动基本信息表的建立: create table Affairs ( AffNo char(6) not null unique, PlaNo char(6) not null, AffName char(20) not null, AffScope char(8) null, AffDepartment char(6) not null, AffScheme char(50) null, AffQuality char(4) not null, primary key(AffNo), foreign key(PlaNo) references WorkingPlan(PlaNo)); foreign key(AffDepartment) references Department(DepNo));, (6)部门基本信息表的建立: create table Department ( DepNo char(6) not null unique, DepName char(14) not null, -25- DepMinName char(8) not null, DepSminSum int null, DepMemSum int null, MinPhoNo char(12) null, primary key(DepNo), foreign key(DepMinName) references Student(StuNo)); (7)文件基本信息表的建立: create table Files( FilesNo char(6) not null unique, FilesName char(10) not null, FilesType char(10) null, FilesBelDep char(6) not null, FilesPerson char(14) not null, RecDisPartner char(14) not null ArcDate datetime null, Remarks char(30) null, primary key(FilesNo), foreign key(FilesBelDep) references Department(DepNo)); (8)活动使用物品基本信息表的建立: create table AffairsGoods ( AffNo char(6) not null, GoodsNo char(8) not null, Gamount int null, primary key(AffNo,GoodsNo), foreign key(AffNo) references Affairs(AffNo), foreign key(GoodsNo) references Goods(GoodsNo)); (9)学生会干部参与活动基本信息表的建立: create table JoinAffairs ( AffNo char(6) not null, StuNo char(8) not null, Present char(8) null, primary key(AffNo, StuNo), foreign key(AffNo) references Affairs(AffNo), foreign key(StuNo) references Student(StuNo)); 3(建立视图 (1)查询学生会干部的基本信息的视图定义如下: create view StuView (编号,姓名,性别,职务,部门,专业,年级,电话,加入日期, 参加过的活动项目) as select * on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 26 from Student with check option; (2)查询和修改各部门的基本信息视图定义如下: create view DepView (编号,名称,部长姓名,副部长人数,部委人数,部长电话) as select * from Department with check option; (3)查看物品的借出和归还信息的视图定义如下: create view GooView (物品编号,物品名称,借出时间,借物人姓名,归还时间,归 还人姓名) as select GoodsNo,GoodsName,GoodsLender,GoodsLendTime, GoodsReturner,GoodsRetTime from Goods with check option; (4)查看活动经费使用情况的视图定义如下: create view FinView (财务编号,金额,申请人姓名,申请部门,余额) as select FinNo,FinMoney,FinPerson,FinDepartment,FinRemain from FinancialAffairs with check option; (5)查看工作计划提交的情况的视图定义如下: create view WPView (编号,工作计划名称,提交部门,提交人,提交时间) as select PlaNo,PlaName,PlaDepartment,PlaPerson,PlaTime from WorkingPlan with check option; (6)查看以往事务活动方案以供来参看的视图定义如下: create view AffView (活动编号,活动名称,承办部门,以往解决方案,是否特色活动) as select AffNo ,AffName,AffDepartment,AffScheme,AffQuality from Affairs with check option; (7)查询以前存档文件的基本信息的视图定义如下: create view FilesView (文件编号,文件名称,类型,所属部门,负责人,收发对象, 存档日期,备注) as select * from Files -27- with check option; (8)查询举办活动物品的使用情况的视图定义如下: create view AGView (事务活动编号,物品编号,使用数量) as select * from AffairsGoods with check option; 4(建立索引 create unique index StudentNo on Student(StuNo); create unique index GoodsNo on GoodsNo(GoodsNo); create unique index FinancialNo on FinancialAffairs (FinNo); create unique index PlaningNo on WorkingPlan(PlaNo); create unique index AffairsNo on Affairs(AffNo); create unique index DepartmentNo on Department(DepNo); create unique index FilesNo on Files(FilesNo); create unique index AffairsGoods on AffairsGoods(AffNo,GoodsNo); create unique index JoinAffairs on JoinAffairs(AffNo,StuNo); create cluster index StudentName on Student(StuName); create unique index FileName on Files(FilesName); 5(数据入库 系统包括学生会干部信息管理、财务管理、日常事务管理、文件管理等四大功能模块, 共有9张基本表,牵涉到大量数据的录入,又由于时间限制,采用事先在Excel中录入数据,然后使用SQL Server 2000数据导入/导出向导功能,直接将数据导入到相应的基本表中。当然,附录中也给出了各个基本表插入元组的存储功能,详细内容请参阅附录2。 1.5.3数据库实施阶段结果 1. 关系模式说明 2. 数据定义语句(见附录) 2 数据库调试与试运行 这次测试用黑盒测试来做的,我们只要检查程序功能是否按需求分析的规定正常使用, 程序能否合理地接收输入数据而进行正确的操作,并且保持外部信息(如数据库)的完整 性。黑盒测试是穷举测试输入,只有把所有可能的输入都作为测试情况使用,才能以这种 方法查出程序中的所有的错误。实际上的测试情况有无穷多个,人们不仅要测试所有合法 的输入,而且要对那些不合法但是可能的输入进行测试。但是对于数据库的测试我认为不 需要进行非法测试,因为DDL语句本身有很强的逻辑性而且句子中有约束条件。 从上面的性能测试已说明数据库系统设计的已经符合用户的需求。但由于高校学生会 管理系统关系到这一核心程序,它与具体的语言有关,在没有具体的用户程序代码之前不 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 28 能做总体的性能测试,但是从数据库的功能测试这一部分的成功测试来看,数据库的性能 也是符合需求的。 具体的测试结果请看附录 附录1数据库逻辑结构定义 1(学生会干部(Student)基本信息表,用于学生会干部的基本信息 附表2.1学生会干部基本信息表 属性名 数据类型 取值范围 是否是主属性或外键 完整性 StuNo char(8) 00000000,99999999 是 Not null StuName char(10) 否 Not null StuPosition char(6) 否 Not null StuSex char(2) 男、女 否 Null StuMajor char(14) 否 Null StuDepart char(20) 是 Not null StuGrade char(8) 否 Null StuPhoneNo char(12) 否 Not null StuStaTime datetime 否 Not null StuCase varchar(50) 否 Null 2(物品(Goods)基本信息表,用于记录学生会物品的基本信息: 附表2.2物品基本信息表 属性名 数据类型 取值范围 是否是主属性或外键 完整性 GoodsNo char(8) 00000000,99999999 是 Not null FinNo char(6) 000000,999999 是 Not null GoodsName char(16) 否 Not null GoodsBuyTime datetime 否 Null GoodsPrice char(6) 否 Not null GoodsLender char(10) 否 Null GoodsLendTime datetime 否 Null GoodsReturner char(10) 否 Null GoodsRetTime datetime 否 Null 3(财务(FinancialAffairs)基本信息表,用于记录财务的基本信息: 附表2.3财务基本信息表 属性名 数据类型 取值范围 是否是主属性或外键 完整性 FinNo char(6) 000000,999999 是 Not null FinPurpose char(30) 否 Null FinMoney char(6) 否 Not null -29- FinPerson char(8) 是 Not null FinTime datetime 否 Null FinDepartment char(6) 是 Not null FinRemain char(6) 否 Null 4(工作计划(WorkingPlan)基本信息表,用于记录各部提交的工作计划的基本信息: 附表2.4工作计划基本信息 属性名 数据类型 取值范围 是否是主属性或外键 完整性 PlaNo char(6) 000000,999999 是 Not null PlaName char(30) 否 Not null PlaDepartment char(6) 是 Not null PlaPerson char(8) 是 Null PlaTime datetime 否 Null PlaQuality char(4) 否 Not null 5(事务活动(Affairs)基本信息表,用于记录学生会各项事务活动的基本信息: 附表2.5事务活动学生基本信息 属性名 数据类型 取值范围 是否是主属性或外键 完整性 AffNo char(6) 000000,999999 是 Not null PlaNo char(6) 000000,999999 是 Not null AffName char(20) 否 Not null AffScope char(8) 否 Null AffDepartment char(6) 是 Not null AffScheme char(50) 否 Null AffQuality char(4) 否 Not null 6(部门(Department)基本信息表,用于记录部门的基本信息: 附表2.6部门基本信息 属性名 数据类型 取值范围 是否是主属性或外键 完整性 DepNo char(6) 000000,999999 是 Not null DepName Char(14) 否 Not null DepMinName char(8) 是 Not null DepSminSum int 0000,9999 否 Null DepMemSum int 0000,9999 否 Null MinPhoNo char(12) 否 Null 7(文件(Files)基本信息表,用于记录学生会所有文件的基本信息: 附表2.7文件基本信息 属性名 数据类型 取值范围 是否是主属性或外键 完整性 on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 30 属性名 数据类型 取值范围 是否是主属性或外键 完整性 FilesNo char(6) 000000,999999 是 Not null FilesName char(20) 否 Not null FilesType char(14) 否 Null FilesBelDep char(8) 是 Not null FilesPerson char(6) 是 Not null RecDisPartner char(14) 否 Null ArcDate datetime 否 Null Remarks char(30) 否 Null 8(活动使用物品(AffairsGoods)基本信息表,用于记录举办活动中使用物品的基本信息: 附表2.8活动使用物品基本信息 属性名 数据类型 取值范围 是否是主属性或外键 完整性 AffNo char(6) 000000,999999 是 Not null GoodsNo char(8) 00000000,99999999 是 Not null Gamount Int 0000,9999 否 Null 9(参与活动(JoinAffairs)基本信息表,记录班费支出的基本信息: 附图2.9 班费支出基本信息 属性名 数据类型 取值范围 是否是主属性或外键 完整性 AffNo char(6) 000000,999999 是 Not null StuNo char(8) 00000000,99999999 是 Not null Present char(4) 否 Not null 附录2存储过程定义 1( p1_ Student _Insert的定义: create procedure p1_Student_Insert @Student_no char(8), @Student_name char(10), @Student_position char(6), @Student_sex char(2), @Student_major char(14), @Student _departname char(20), @Student_grade char(8), @Student_phoneno char(12), @Student_statime datetime, @Student_ case varchar(50) -31- as insert into Student values(@Student_no,@Student_name,@Student_position,@Student_sex, @Student_major,@Student_departname,@Student_grade,@Student_phoneno, @Student_statime, @Student_case); 2(p2_Goods_Insert的定义: create procedure p2_Goods_Insert @goods_no char(8), @finacialaffirs_no char(6) @goods_name char(16), @goods_buytime datetime, @goods_price char(6), @goods_Lender char(10) @goods_LendTime datetime, @goods_returner char(10), @goods_rettime datetime, as insert into Goods uytime, @goods_price, values(@goods_no, @finacialaffirs_no ,@goods_name, @goods_b @goods_Lender,@goods_LendTime, @goods_returner, @goods_rettime); 3(p3_FinancialAffairs_Insert的定义: create procedure p3_FinancialAffairs_Insert @financialaffairs_no char(6), @financialaffairs_purpose char(30), @financialaffairs_money char(6), @financialaffairs_Person char(8), @financialaffairs_time datetime, @financialaffairs_department char(6), @financialaffairs_remain char(6) as insert into FinancialAffairs values(@financialaffairs_no, @financialaffairs_purpose, @financialaffairs_money, @financialaffairs_Person, @financialaffairs_time, @financialaffairs_department, @financialaffairs_remain); 4(p4_WorkingPlan_Insert的定义: create procedure p4_WorkingPlan_Insert @workingplan_no char(6), @workingplan_name char(30), @workingplan_departmnet char(6), @workingplan_person char(8), on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 32 @workingplan_time datetime, @workingplan_quality char(4), as insert into WorkingPlan values(@workingplan_no,@workingplan_name,@workingplan_departmnet, @workingplan_person,@workingplan_time,@workingplan_quality); 5(p5_Affairs_Insert的定义: create procedure p5_Affairs_Insert @affairs_no char(6), @workingplan_no char(6), @affirs_name char(8), @affirs_department char(6), @affirs_scheme char(50), @affirs_quality char(4), as insert into Affairs values(@affairs_no, @workingplan_no, @affirs_name, @affirs_department, @affirs_scheme, @affirs_quality); 6(p6_Department_Insert的定义: create procedure p6_Department_Insert @department_no char(6), @department_name char(14), @department_minname char(8), @department_sminsum int, @department_memsum int, @department_phono char(12) as insert into Department values(@department_no,@department_name, @department_minname, @department_sminsum, @department_memsum, @department_phono); 7(p7_Files_Insert的定义: create procedure p7_Files_InSert @files_no char(6), @files_name char(20), @files_type char(14), @files_beldep char(8), @files_person char(10), @files_recdispatrner char(14), @files_arcdate datetime, @files_remarks char(30), -33- as insert into Files values(@files_no , @files_name, @files_type, @files_beldep, @files_person, @files_recdispatrner, @files_arcdate, @files_remarks); 8(p8_ AffairsGoods_Insert的定义 create procedure p8_AffairsGoods_Insert @affairs_no char(6), @goods_no char(8), @affairsgoods_gamount int, as insert into AffairsGoods values(@affairs_no, @goods_no, @affairsgoods_gamount); 9(p9_ JoinAffairs_Insert的定义: create procedure p9_FitmentCompensate @affairs_no char(6), @student_no char(8), @joinaffairs_present char(4), as insert into JoinAffairs values(@affairs_no, @student_no, @joinaffairs_present); 10(p10_Query_Department的定义: create procedure p10_Query_ Department @department_no char(6) as select * from DepView where 部门编号 = ltrim(@department_no); 11(p11_Query_Department的定义: create procedure p11_Query_ Department @ department _name char(14) as select * from DepView where 部门名称 like ltrim(@department_name)+’%’; 12(p12_Delete_Department的定义: create procedure p12_Delete_Department @department_no char(6) as delete from DepView on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 34 where 部门编号 = rtrim(ltrim(@department_no)); 13(p13_Delete_Department的定义: create procedure p16_Delete_Department @department_name char(14) as delete from DepView where 部门名称 like rtrim(ltrim(@department_name)); 附录3数据查看和存储过程功能的验证 1(基于数据表的数据查询 (1)查看Student表中的数据: (2)查看Goods表中的数据: -35- (3)查看FinancialAffairs表中的数据: (4)查看WorkingPlan表中的数据: (5)查Affairs表中的数据: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 36 (6)查看Department表中的数据: (7)查看Files表的数据: -37- 2(基于视图的数据查询 (1)查看WPView表中的数据: (2)查看AffView表中的数据: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 38 (3)查看FilesView表中的数据: (4)查看AGView表中的数据: -39- 3(存储过程功能的验证 (1)存储过程p1_ Student _Insert功能的验证: (2)存储过程p2_Goods_Insert功能的验证: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 40 (3)存储过程p3_FinancialAffairs_Insert功能的验证: (4)存储过程p6_Department_Insert功能的验证: -41- (5)存储过程p4_WorkingPlan_Insert功能的验证: (6)存储过程p10_Query_Department功能的验证: on improving service, the abilitygood decisions of party committees and Governments, determined to complete work assigned by the superior party. Third, focus erformembers. Both staff members and no staff members, both vigorous and resolute working style, good at policy advocacy, and to pwork. No free ride thing under the Sun, if you cannot play a vanguard and exemplary role of party members is unworthy party mpractices. The development of various undertakings, requires each party to pay and hard 42 (7)存储过程p11_Query_Department功能的验证: (8)存储过程p12_Delete_Department功能的验证: (注:由于篇幅限制,这里仅给出了其中几个存储过程功能的验证) -43-
/
本文档为【实例3:高校学生会管理系统数据库设计】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
热门搜索

历史搜索

    清空历史搜索