当前位置:文档之家› 学生档案管理系统数据库设计书

学生档案管理系统数据库设计书

学生档案管理系统数据库设计书1.1 课程设计目的编写的这个再就业服务中心管理信息系统,第一是为了学以致用,将学到的知识运用到实际中去,第二也是为了学到更多的东西,加深自己对C#和SQL的理解。

1.2 开发背景随着我国市场经济的快速发展和信息化水平的不断提高和网络运用的不断普及,如何利用先进的管理手段,提高高校管理的水平,是当今社会所面临的一个课题。

各种各样的网上管理系统应运而生。

1.3 需求分析1.4 开发环境Visual Studio 是微软公司推出的开发环境。

是目前最流行的Windows 平台应用程序开发环境。

Visual Studio 可以用来创建Windows 平台下的Windows 应用程序和网络应用程序,也可以用来创建网络服务、智能设备应用程序和Office 插件。

2.1 系统功能描述学生档案管理系统包括用户管理模块、档案管理模块、成绩管理模块,奖惩管理模块、基本信息管理模块、帮助模块。

用户管理模块:对系统用户进行管理,包括添加新用户,对已有用户的查询修改,用户密码采用md5加密方法进行加密,以提高用户帐号的安全性。

档案管理模块:对学生的档案信息进行管理,包括档案的录入,档案的查询,档案的修改,方便管理者进行管理,无需传统的手填表式管理,降低了出错的可能性。

成绩管理模块:对学生的成绩进行管理,包括成绩的录入,成绩的修改,成绩的查询,方便管理人员适时的对学生的成绩进行操作,同时也方便了管理人员对学生成绩的了解。

奖惩管理模块:对学生的奖惩信息进行记录,修改,查询,让每个人的信息可以及时的体现在档案上,方便以后的查询。

基本信息管理模块:对学生的一些基本信息进行管理,及时的修改学生的基本信息,可做到及时性,准确性。

帮助模块:对学生档案管理系统进行介绍,对一些基本信息和使用方法向用户做初步的介绍,方便用户的使用和减少用户摸索的时间,提高用户的工作效率。

2.2 功能模块图2.3 关系模式图3.1 E-R 图3.2关系图班级表一Class学院表--College课程表一Course院系表--Dept获奖表--HuoJia ng茎① pms ——O S ——*5E o o ^*p」eM①耳—<8uscnd ——*!?威用户表--Users违纪表--WeiJi3.3创建表、视图、索引脚本一、数据库创建:CREATEDATABASStude ntRecordDBON(NAM=StudentRecordDB_data , FILENAME='f:\studentrecorddb\StudentRecordDB _data.mdf' ) LOGON(NAM=StudentRecordDB_log , FILENAME='f:\studentrecorddb\StudentRecordDB_log.ldf' ) GO2、班级表:CREATETABLEClass (ClassID CHAR8) NOT NULL,ClassName CHAR20) NOTNULL,DeptID CHAR8) NULL,)3、院系表CREATETABLECollege (CollegeID CHAR8) NOTNULL,CollegeName CHAR20) NOTNULL,CollegeSummary CHAR10) NULL,)4、课程表CREATETABLECourse (Cno CHAR 10) NOTNULL,Cname CHAR 10) NOTNULL,keshi int NOTNULL,xuefe n int NOTNULL,ksxs char (8) NOTNULL)5、系表:CREATETABLEDept (DeptID CHAR( 8) NOT NULL, DeptName CHAR( 30) NOT NULL, CollegeID CHAR( 8) NULL)6、获奖表:CREATETABLEHuoJiang ( Sno CHAR( 10) NOT NULL, RewardID CHAR( 8 ) NOT NULL, Time datetime NULL)7、处罚表:CREATETABLEPunish (PunishID char (8) NOT NULL, PunishName char (10) NULL)8、奖励表:CREATETABLEReward (RewardID char (8) NOT NULL, RewardName char (10) NOT NULL, RewardLevel char ( 10) NOTNULL)9、宿舍表:CREATETABLERoom(RoomID char (8) NOT NULL, RoomAdd char ( 20) NOT NULL, RoomNumint NOT NULL)10、选课表:CREATETABLESC(Sno char ( 10) NOT NULL, Cno char ( 10) NOT NULL, Score int NULL)11、学生表:CREATETABLEStudent (Sno char ( 10) NOT NULL, S_name char (8) NOT NULL, S_xmpy char (20) NOT NULL, S_cym char ( 8) NULL, S_sex char ( 2) NOT NULL, S_age int NOT NULL, S_mz char (10) NOT NULL, S_jg char (100) NOT NULL, S_csrq datetime NOT NULL, RommIDint NULL, ClassID int NULL, S_sfzh char (15) NOT NULL,S_image image NULL, S_zzmm char (4) NOT NULL, S_csd char ( 100) NULL, S_syd char ( 100) NOT NULL, S_rxnf datetime NOT NULL, S_byxx char (20) NOT NULL, S_pycc char (10) NOT NULL, S_jtzz char (100) NOT NULL, S_jtlxdh char (15) NULL, S_sj char (11) NULL)12、用户表:CREATETABLEUsers ( Uid int NOT NULL, Uname char (20) NOT NULL, PassWord char (20) NOT NULL)13、违纪记录表:CREATETABLEWeiJi ( Sno char ( 10) NOT NULL, PunishID char (8) NOT NULL, Time datetime NOT NULL, chulijieguo text NULL) GO二、视图-- 查询成绩USEStudentRecordDB GO CREATEVIEWSCORE_VIEWAS SELECTStudent .Sno, S_name, Cname, Score FROMStudent , Course , SCWHEREStudent . Sno=sc . Sno ANDSC. Cno=Course . CnoGO-- 查询基本信息USEStudentRecordDBGO CREATEVIEWjbxx_VIEWAS SELECTStudent .Sno, S_name, S_sex, S_age, S_jg , S_zzmm, S_rxnf , S_jtzz , S_sj , Class .ClassID , Dept. DeptID , Room. RoomIDFROMStudent , Class , Dept , RoomWHEREStudent . ClassID =Class . ClassID ANDClass . DeptID =Dept . DeptID AND Student . RoomID=Room. RoomIDGO-- 查询获奖情况USEStudentRecordDBGOCREATEVIEWHJ_VIEWAS SELECTStudent .Sno, S_name, RewardNameFROMStudent , HuoJiang , RewardWHEREStudent . Sno=HuoJiang . Sno ANDHuoJiang . RewardID =Reward. RewardID GO-- 查询违纪情况USEStudentRecordDBGO CREATEVIEWCF_VIEWAS SELECTStudent .Sno, S_name, PunishName , chulijieguoFROMStudent , WeiJi , PunishWHEREStudent . Sno=WeiJi . Sno ANDWeiJi . PunishID =Punish . PunishID GO-- 通过姓名和课程名查询该生该课程成绩IF EXISTS ( SELECTNAMEFROMsysobjects WHERENAME='Pro_S_name' AND TYPE='p' ) DROPPROCEDURPEro_S_nameGOcreate procedure Pro_QScore@S_name_in char (8), @Cname_in char (10), @Score_out int outputAs select @Score_out =Score from student , course , sc where student .Sno=sc. Sno and course . Cno=sc . Cno and S_name=@S_name_in and Cname=@Cname_in三、索引-- 创建索引use StudentRecordDBgocreate index ind_ClassID on Class ( ClassID )create index ind_Cno on Course (Cno)create index ind_DeptID on Dept ( DeptID )create index ind_huojiang on HuoJiang ( Sno, RewardID )create index ind_PunishID on Punish ( PunishID )create index ind_RewardID on Reward ( RewardID )create index ind_RoomID on Room( RoomID)create index ind_sc on SC( Sno, Cno)create index ind_Sno on Student ( Sno)create index ind_Uid on Users ( Uid)create index ind_weiji on WeiJi ( Sno, PunishID )go3.4 完整性约束、自定义约束--class 表约束use StudentRecordDBgoalter table Classadd constraint pk_ClassID primary key ( ClassID ) go--course 表约束use StudentRecordDBgoalter table Courseadd constraint pk_Cno primary key ( Cno)go--dept 表约束use StudentRecordDBgoalter table Deptadd constraint pk_DeptID primary key( DeptID ) go--huojiang 表约束use StudentRecordDBgoalter table HuoJiangadd constraint pk_huojiang primary key( Sno, RewardID ) go --punish 表约束use StudentRecordDBgoalter table Punishadd constraint pk_PunishID primary key( PunishID ) go--reward 表约束 use StudentRecordDB go alter table Rewardadd constraint pk_RewardID primary key( RewardID ) go --room 表约束 use StudentRecordDB go alter table Roomadd constraint pk_RoomID primary key( RoomID) go --sc 表约束use StudentRecordDB go-- 参照完整性 use StudentRecordDB goALTER TABLESC WITH NOCHECKADD CONSTRAINTFK_student_sc FOREIGNKEY( Sno) REFERENCE S tudent (Sno) ON DELETECASCADEALTER TABLESC WITH NOCHECKADD CONSTRAINTFK_course_sc FOREIGNKEY( Cno) REFERENCECSourse ( Cno) ON DELETECASCADEALTER TABLEHuoJiang WITH NOCHECKADD CONSTRAINTFK_student_huojiang FOREIGNKEY( Sno) REFERENCE S tudent (Sno)ON DELETECASCADEgoalter table SCadd constraint pk_sc go--student 表约束 use StudentRecordDB goalter table Studentadd constraint pk_Sno go--Users 表约束use StudentRecordDB go alter table Usersadd constraint pk_Uid go--weiji 表约束 use StudentRecordDB goalter table WeiJiadd constraint pk_weijiprimary key( Sno, Cno)primary key ( Sno)primary key ( Uid )primary key ( Sno)ALTER TABLEHuoJiang WITH NOCHECKADD CONSTRAINTFK_reward_huojiang FOREIGNKEY( RewardID) REFERENCESReward( RewardID )ON DELETECASCADEALTER TABLEWeiJi WITH NOCHECKADD CONSTRAINTFK_student_weiji FOREIGNKEY( Sno) REFERENCE S tudent (Sno)ON DELETECASCADEALTER TABLEWeiJi WITH NOCHECK ADDCONSTRAINTFK_punish_weiji FOREIGNKEY( PunishID ) REFERENCEPSunish ( PunishID ) ON DELETECASCADEuse StudentRecordDBgocreate index ind_ClassID on Class ( ClassID )create index ind_Cno on Course (Cno)create index ind_DeptID on Dept ( DeptID )create index ind_huojiang on HuoJiang ( Sno, RewardID )create index ind_PunishID on Punish ( PunishID )create index ind_RewardID on Reward ( RewardID )create index ind_RoomID on Room( RoomID)create index ind_sc on SC( Sno, Cno)create index ind_Sno on Student ( Sno)create index ind_Uid on Users ( Uid)create index ind_weiji on WeiJi ( Sno, PunishID ) go--class 表约束( 实体完整性) use StudentRecordDB go alter table Classadd constraint pk_ClassID go --course 表约束( 实体完整性) useStudentRecordDB go alter table Courseadd constraint pk_Cno go --dept 表约束( 实体完整性) use StudentRecordDB go alter table Dept add constraint pk_DeptID go --huojiang 表约束( 实体完整性) use StudentRecordDB go alter table HuoJiangadd constraint pk_huojiang go --punish 表约束( 实体完整性) use StudentRecordDB go alter table Punishadd constraint pk_PunishID go --reward 表约束( 实体完整性) use StudentRecordDB go alter table Rewardadd constraint pk_RewardID go --room 表约束( 实体完整性) use StudentRecordDB primary key ( ClassID )primary key ( Cno)primary key( DeptID )primary key( Sno, RewardID )primary key( PunishID )primary key( RewardID )goalter table Roomadd constraint pk_RoomID primary key( RoomID) go--sc 表约束( 实体完整性) use StudentRecordDB goalter table SCadd constraint pk_sc primary key( Sno, Cno) go--student 表约束( 实体完整性) use StudentRecordDB go alter table Studentadd constraint pk_Sno primary key ( Sno) go--Users 表约束( 实体完整性) use StudentRecordDB go alter table Usersadd constraint pk_Uid primary key ( Uid ) go--weiji 表约束( 实体完整性) use StudentRecordDB goalter table WeiJiadd constraint pk_weiji primary key ( Sno) go-- 参照完整性use StudentRecordDB goALTER TABLESC WITH NOCHECKADD CONSTRAINTFK_student_sc FOREIGNKEY( Sno) REFERENCE S tudent (Sno) ONDELETECASCADEALTER TABLESC WITH NOCHECKADD CONSTRAINTFK_course_sc FOREIGNKEY( Cno) REFERENCECSourse ( Cno) ON DELETECASCADEALTER TABLEHuoJiang WITH NOCHECK ADD CONSTRAINTFK_student_huojiang ON DELETECASCADEFOREIGNKEY( Sno) REFERENCE S tudent (Sno) ALTER TABLEHuoJiang WITH NOCHECKADD CONSTRAINTFK_reward_huojiang FOREIGNKEY( RewardID) REFERENCESReward( RewardID )ON DELETECASCADEALTER TABLEWeiJi WITH NOCHECKADD CONSTRAINTFK_student_weiji FOREIGNKEY( Sno) REFERENCE S tudent (Sno)ON DELETECASCADEALTER TABLEWeiJi WITH NOCHECK ADDCONSTRAINTFK_punish_weiji FOREIGNKEY( PunishID ) REFERENCEPSunish ( PunishID ) ON DELETECASCADE3.5 存储过程-- 通过姓名和课程名查询该生该课程成绩IF EXISTS ( SELECTNAMEFROMsysobjects WHERENAME='Pro_S_name' AND TYPE='p' ) DROPPROCEDURPEro_S_nameGOcreate procedure Pro_QScore@S_name_in char (8), @Cname_in char (10), @Score_out int output As select @Score_out =Scorefrom Student , Course , SCwhere Student . Sno=SC. Sno and Course . Cno=SC. Cnoand S_name=@S_name_in and Cname=@Cname_in3.6 触发器-- 建立一个触发器,如果修改Student 中的学号,则SC、HouJiang 、WeiJi 中的学号自动修改。

相关主题