Oracle数据库课程设计题目学生成绩管理系统 _______班级10级软工数据库一班姓名________ 谢铮________________ 学号_______ 105151640043扌旨导老0帀 ____ 刘杨涛 ________2013年1月5日目录一、前言 (2)二、需求分析 (3)三、系统设计 (5)四、数据库设计 (7)五、编程步骤 (19)六、测试 (25)七、课程设计总结 (33)八、参考资料 (34)九、附录 (34)学生成绩管理是一个学校必不可少的部分,随着计算机和计算机知识的普及,学生成绩管理系统得到了更大的发展空间,通过对学生成绩管理系统的开发,可以提高校务人员的工作效率。
本次课程设计以java web 技术设计学生成绩管理系统为前台,使用oracle 数据库作为后台数据存储。
学生成绩管理是一个学校不可缺少的部分,一个良好的学生成绩管理系统应该能够为用户提供充足的信息和快捷的查询手段。
学生成绩管理系统对学校加强学生成绩管理有着极其重要的作用.由于各个大学都在持续扩招,学生的数量日益庞大,对于如何管理如此庞大的学生成绩数据显得更为复杂,传统的手工成绩管理不仅工作量大,而且容易出现问题,如:效率低、保密性差,另外时间一长,将产生大量的文件和数据,这对于查找、更新和维护都带来了不少的困难。
已不能适应时代的发展。
随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。
作为计算机应用的一部分,使用计算机对学生成绩信息进行管理,具有手工管理所无法比拟的优点。
例:检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等。
这些优点能够极大地提高管理者管理的效率,也是学校走向科学化、正规化管理,与世界接轨的重要条件。
因此,开发设计这样一套学生成绩管理软件成为很有必要的事情.二、需求分析1.功能需求1.学生基本信息及所选科目成绩的录入或导入。
2.基本信息的查询(分系、班级;分科目)与修改。
3.对每系或每班各科成绩进行分析(即求单科平均成绩、及格率和优秀率);4.对所开课程的成绩分析(求其平均成绩,最高分和最低分);5.对学生考试成绩进行排名(单科按系别或班级进行排名,对每一个班级,同一学期学生总体成绩进行排名,并显示各科成绩信息)6.不及格情况的统计、导出、打印2.系统需求该学生成绩管理系统采用java语言开发研制,JavaBean作为行为模型,servlet作为响应服务器,DIV+CSS+javascript设计网页,oracle作为数据存储。
在完成用户需求同时,完成条件查询等功能。
针对学生成绩及其数据特点,可以全面实现对学生成绩的插入、查询、修改、删除和输出等功能的计算机管理。
它能使学生成绩数据的工作人员从繁重的工作中解脱出来,大大减轻了工作量,减少人为的工作失误,全面提高学生成绩管理的效率,从而使学校对于学生成绩的管理水平和技术水平跃上一个新的台阶。
3.系统开发环境1.开发语言:java+jsp2.开发工具:IE 8.0,Tomcat ,jdk 1.7,dreamweaver3.数据库:Oracle 10g4.文档编写工具:word5.服务器端运行环境:oracle 10g,Tomcat ,jdk 1.76.客户端运行环境:浏览器三、系统设计1.功能模块2.系统流程图3.数据字典(i)数据存储数据表:用户表表组成:用户名,密码数据项:用户名数据类型:varchar 数据长度:50否否数据项:密码数据类型:varchar数据长度:50(2)数据流定义:登陆名称:登陆简述:用户登陆系统数据来源:用户数据去向:用户表数据组成:用户名+密码四、数据库设计1■数据库结构设计2.实体联系图3. 数据库源代码select userenv('language') from dual; shutdown immediate startup mountALTER SYSTEM ENABLE RESTRICTED SESSION; ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; ALTER SYSTEM SET AQ_TM_PROCESSES=0; ALTER DATABASE OPEN;alter databasecharacter set INTERNAL_USE UTF8; shutdown immediate startup create user xz105151640043 identified by xz管理管理管理管理用户名密码科目名学号成绩性别姓名 学号 出生日期所在班级班级名年级系别任课老师科目名联系电话科目信息班级信息成绩信息学生信息教师用户/grant dba to xz/conn xz105151640043/xz/set serveroutput on/create table user_(name varchar(50) primary key,passwd varchar(50) not null) /insert into user_ values('xz','xz');/Commit/create table cs(cs_class varchar(50) primary key,cs_dept varchar(50) not null,cs_grade varchar(50) not null)/create table student(stu_no varchar(15) primary key,stu_name varchar(10) not null,stu_sexvarchar(4) not null check (stu_sex='男'or stu_sex='女'), stu_birthday varchar(50) , stu_phone varchar(50), stu_cs_classvarchar(50) ,constraint class_fk foreign key(stu_cs_class) references cs(cs_class)on delete cascade)/create table sub(sub_subject varchar(50) primary key, sub_teacher_namevarchar(10))/create table gd(gd_stu_no varchar(15),gd_sub_subject varchar(50),gd_grade number(3) not null,primary key(gd_stu_no,gd_sub_subject),constraint fk_gd_stu_no foreign key(gd_stu_no) references student(stu_no), constraintfk_gd_sub_subject foreign key(gd_sub_subject) references sub(sub_subject) )/create or replace procedure p_insert_stu( p_stu_no in student.stu_no%type, p_stu_name in student.stu_name%type, p_stu_sex in student.stu_sex%type, p_stu_birthday instudent.stu_birthday%type, p_stu_phone in student.stu_phone%type, p_stu_cs_class instudent.stu_cs_class%type, s_state_valuesout number) as begininsert into student (stu_no,stu_name,stu_sex,stu_birthday,stu_phone,stu_cs_class) values (p_stu_no,p_stu_name,p_stu_sex,p_stu_birthday,p_stu_phone,p_stu_cs_class); if sql%rowcount=1 then s_state_values:=0;end if; exceptionwhen others then s_state_values:=1;commit; end ;/create or replace procedure c_insert_stu( c_stu_no in student.stu_no%type, c_state_valuesout number) as beginselect count(*) into c_state_values from studentwhere stu_no=c_stu_no;end ; / create or replace procedure c_insert_stu_fk( c_cs_classin cs.cs_class%type,c_state_values_fk out number) as beginselect count(*) into c_state_values_fk from cswhere cs_class=c_cs_class;end ; /create or replace procedure p_insert_cs( p_cs_dept in cs.cs_dept%type, p_cs_grade incs.cs_grade%type, p_cs_class in cs.cs_class%type, s_state_valuesout number) as begin insertinto cs(cs_dept,cs_grade,cs_class) values(p_cs_dept, p_cs_grade, p_cs_class); if sql%rowcount=1 then s_state_values:=0;end if; exceptionwhen others then s_state_values:=1; commit; end ;/create or replace procedure c_insert_cs( c_cs_classin cs.cs_class%type, c_state_valuesout number) as beginselect count(*) into c_state_values from cs where cs_class=c_cs_class;end ; / create or replace procedure p_insert_sub( p_sub_subject in sub.sub_subject%type,p_sub_teacher_namein sub.sub_teacher_name%type, s_state_valuesout number) as begininsert into sub(sub_subject,sub_teacher_name) values(p_sub_subject, p_sub_teacher_name); if sql%rowcount=1 then s_state_values:=0;end if; exceptionwhen others then s_state_values:=1; commit;end;/ create or replace procedure c_insert_sub( c_sub_subject in sub.sub_subject%type,c_state_valuesout number) as beginselect count(*) into c_state_values from subwhere sub_subject=c_sub_subject;end ;/create or replace procedure p_insert_gd( p_gd_stu_no in gd.gd_stu_no%type, p_gd_sub_subject in gd.gd_sub_subject%type, p_gd_grade in gd.gd_grade%type, s_state_valuesout number) as begin insert into gd(gd_stu_no,gd_sub_subject,gd_grade)values(p_gd_stu_no,p_gd_sub_subject,p_gd_grade); if sql%rowcount=1then s_state_values:=0;end if;exceptionwhen others then s_state_values:=1;if p_gd_grade=nullthen s_state_values:=2;end if;commit;end ;/create or replace procedure c_insert_gd( p_gd_stu_no in gd.gd_stu_no%type, p_gd_sub_subject in gd.gd_sub_subject%type, c_state_valuesout number) as beginselect count(*) into c_state_values from (select gd_stu_no from gdwhere gd_sub_subject=p_gd_sub_subject where gd_stu_no=p_gd_stu_no;end ; / create or replace procedure c_insert_gd_fk1( c_stu_no in student.stu_no%type,c_state_values_fk1 out number) as begin select count(*) into c_state_values_fk1 from student where stu_no=c_stu_no;end ; / create or replace procedure c_insert_gd_fk2( c_sub_subject in sub.sub_subject%type,c_state_values_fk2 out number) as beginselect count(*) into c_state_values_fk2 from subwhere sub_subject=c_sub_subject;end ; / create or replace procedure p_select_stu_no_info( p_stu_no in out student.stu_no%type, p_stu_name out student.stu_name%type, p_stu_sex out student.stu_sex%type, p_stu_birthday out student.stu_birthday%type, p_stu_phone out student.stu_phone%type, p_stu_cs_class out student.stu_cs_class%type, p_cs_dept out cs.cs_dept%type, p_cs_grade out cs.cs_grade%type,c_state_valuesout number) as begin c_state_values:=0;select stu_no, stu_name,stu_sex,stu_birthday ,stu_phone ,stu_cs_class,cs_dept ,cs_gradeinto p_stu_no, p_stu_name, p_stu_sex, p_stu_birthday, p_stu_phone, p_stu_cs_class, p_cs_dept, p_cs_grade from student, cs where stu_cs_class=cs_classand stu_no=p_stu_no;exceptionwhen NO_DATA_FOUND then c_state_values:=1;when others then c_state_values:=2; end ;/create or replace procedure p_select_stu_no_gd(p_stu_no in student.stu_no%type , cursor_gd out sys_refcursor) as beginopen cursor_gd forselect gd_sub_subject,gd_gradefrom gdwhere gd_stu_no=p_stu_no;end;/create or replace procedure p_select_stu_name(p_stu_name in student.stu_name%type ,cursor_stu out sys_refcursor,c_state_valuesout number) as beginc_state_values:=0;open cursor_stu forselect stu_no, stu_name,stu_sex,stu_birthday ,stu_phone ,stu_cs_class,cs_dept ,cs_grade from student, cswhere stu_name=p_stu_nameand stu_cs_class=cs_class;exceptionwhen others then c_state_values:=2;end;/create or replace procedure p_pm_sum( cursor_gd_sum out sys_refcursor)asbeginopen cursor_gd_sum forselect distinct sno,stu_name,sumfrom student,(select gd_stu_no as sno,sum(gd_grade) assumfrom gdgroup by gd_stu_no)where stu_no=snoorder by sum desc;end;/create or replace procedure p_pm_sub(p_gd_sub_subject in gd.gd_sub_subject%type, cursor_gd_sub out sys_refcursoras begin open cursor_gd_sub for select gd_stu_no,stu_na from gd,student wheregd_sub_subject=p_gd_sub_subject and stu_no=gd_stu_no order by gd_grade desc;end;create or replace procedure p_pm_class( p_stu_cs_class in student.stu_cs_class%type,cursor_gd_class out sys_refcursor)asbeginopen cursor_gd_class forselect distinct sno,stu_name,sumfrom student,(select gd_stu_no as sno,sum(gd_grade) assum from gdgroup by gd_stu_no)where stu_no=sno and stu_cs_class=p_stu_cs_classorder by sum desc;end;/create or replace procedure p_fx( cursor_fx out sys_refcursor)asbeginopen cursor_fx forselect gd_sub_subject,max(gd_grade) as zuigao,min(gd_grade) as zuidi,avg(gd_grade)as pingjun,SUM(CASE WHEN gd_grade>=60 THEN 1 ELSE 0 END)/COUNT(*)*100 AS jigelv, SUM(CASE WHENgd_grade>=80 THEN 1 ELSE 0 END)/COUNT(*)*100 AS youxiulv from gdgroup by gd_sub_subject; end;/ create or replace procedure p_bujige( cursor_bujige out sys_refcursor )as begin open cursor_bujige forselect gd_stu_no,gd_sub_subject,gd_grade from gdwhere gd_grade<60;end; / create or replace procedure p_update_stu( p_stu_no in student.stu_no%type, p_stu_name in student.stu_name%type, p_stu_sex in student.stu_sex%type, p_stu_birthday instudent.stu_birthday%type, p_stu_phone in student.stu_phone%type, p_stu_cs_class instudent.stu_cs_class%type, s_state_valuesout number) as begin update student setstu_name=p_stu_name,stu_sex=p_stu_sex,stu_birthday=p_stu_birthday,stu_phone=p_stu_phone,stu_cs_class=p_stu_cs_classwhere stu_no=p_stu_no; if sql%rowcount=1 then s_state_values:=0; end if;exceptionwhen others then s_state_values:=1;commit; end ;/create or replace procedure p_delete_stu( p_stu_no in student.stu_no%type, s_state_valuesout number) as begindelete from gd where gd_stu_no=p_stu_no; delete from student where stu_no=p_stu_no;s_state_values:=0;exceptionwhen others then s_state_values:=1;rollback;commit;end;/ create or replace procedure p_update_gd( p_gd_stu_no in gd.gd_stu_no%type,p_gd_sub_subject in gd.gd_sub_subject%type,p_gd_grade in gd.gd_grade%type, s_state_valuesout number) asbeginupdate gdset gd_stu_no=p_gd_stu_no,gd_sub_subject=p_gd_sub_subject,gd_grade=p_gd_grade wheregd_stu_no=p_gd_stu_no and gd_sub_subject=p_gd_sub_subject;if sql%rowcount=1then s_state_values:=0;end if;exceptionwhen others then s_state_values:=1;rollback;commit;end ;/create or replace procedure p_delete_gd( p_gd_stu_no in gd.gd_stu_no%type, p_gd_sub_subject in gd.gd_sub_subject%type, s_state_valuesout number)asbegindelete from gdwhere gd_stu_no=p_gd_stu_no and gd_sub_subject=p_gd_sub_subject; if sql%rowcount=1then s_state_values:=0;end if;exceptionwhen others then s_state_values:=1;rollback;commit;end ;/create or replace procedure p_denglu( p_name in user_.name%type, p_passwd in user_.passwd%type, s_state_valuesout number)asbeginselect count(*) into s_state_valuesfrom user_where name=p_name and passwd=p_passwd;end;/create or replace procedure p_update_passwd( p_name in user_.name%type, p_passwd inuser_.passwd%type, s_state_valuesout number) as begin update user_ set passwd= p_passwd where name=p_name;if sql%rowcount=1then s_state_values:=0;end if; exceptionwhen others then s_state_values:=1;rollback;commit;end;/create or replace procedure p_select_no( cursor_stu_no out sys_refcursor) as begin open cursor_stu_no for select stu_no from student order by stu_no;end;/create or replace procedure p_select_all( cursor_all out sys_refcursor)asbegin open cursor_all for select stu_no,stu_name,stu_sex,stu_birthday ,stu_phone ,stu_cs_class,cs_dept ,cs_grade from student, cs where stu_cs_class=cs_classorder by stu_no;end;/create or replace procedure p_select_count( myrowcount out number)as beginselect count(*) into myrowcount from student;end;/五、编程步骤1.连接数据库的javabean由于在本系统的多个JSP页面中都需要访问数据库,因此使用一个JavaBean 来专门完成数据库的连接。