#Oracle数据库课程设计报告学生成绩管理系统 下载本文

内容发布更新时间 : 2024/12/22 19:23:11星期一 下面是文章的全部内容请认真阅读。

数据类型:varchar 数据长度:50 (2) 数据流定义: 登陆

名 称: 登陆

简 述: 用户登陆系统 数据来源: 用户 数据去向:用户表

数据组成:用户名+密码

四、数据库设计

1.数据库结构设计

院系表(cs) 字段名 Cs_class Cs_dept Cs_grade 字段名 Gd_stu_no Gd_grade 字段名 Sub_subject 数据类型 Varchar2(50) Varchar2(50) Varchar2(50) 数据类型 Varchar2(15) Number(3) 数据类型 Varchar2(50) 是否为空 Not null Not null Not null 成绩表(gd) 是否为空 Not null Not null Not null 科目表(sub)

是否为空 Not null 是否为空 Not null Not null Not null 说明 科目名(主键) 任课老师名 说明 学号(主键) 学生名 班级名(外键) 性别(约束) 出生日期 联系电话 说明 用户名(主键) 密码 说明 学号(联合主键、外键) 科目(联合主键、外键) 成绩 说明 班级名(主键) 系别 年级 Gd_sub_subject Varchar2(50) Sub_teacher_name Varchar2(10) 字段名 Stu_no Stu_name Stu_cs_class Stu_sex Stu_birthday Stu_phone 字段名 name Passwd 数据类型 Varchar2(15) Varchar2(10) Varchar2(50) Varchar(4) Varchar2(50) 学生表(student) Varchar2(200) 用户表(user_) 数据类型 Varchar2(50) Varchar2(50) 是否为空 Not null notnull 2.实体联系图

姓名 学号 性别 联系电话 所在班级 出生日期 科目名 学生信息 成绩信息 成绩 管理 管理 班级名 学号 班级信息 教师用户 管理 年级 系别 管理 用户名 密码 科目信息 任课老师 科目名 3.数据库源代码

select userenv('language') from dual; shutdown immediate startup mount

ALTER SYSTEM ENABLE RESTRICTED SESSION; ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; ALTER SYSTEM SET AQ_TM_PROCESSES=0; ALTER DATABASE OPEN;

alter database character 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_sex varchar(4) not null check (stu_sex='男'or stu_sex='女'), stu_birthday varchar(50) , stu_phone varchar(50), stu_cs_class varchar(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_name varchar(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),

constraint fk_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 in student.stu_birthday%type, p_stu_phone in student.stu_phone%type, p_stu_cs_class in student.stu_cs_class%type, s_state_values out number ) as begin insert 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; exception when 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_values out number) as begin

select count(*) into c_state_values from student where stu_no=c_stu_no; end ; /

create or replace procedure c_insert_stu_fk( c_cs_class in cs.cs_class%type, c_state_values_fk out number) as begin

select count(*) into c_state_values_fk from cs where cs_class=c_cs_class; end ; /

create or replace procedure p_insert_cs( p_cs_dept in cs.cs_dept%type, p_cs_grade in cs.cs_grade%type, p_cs_class in cs.cs_class%type, s_state_values out number) as begin

insert into 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; exception when others then s_state_values:=1; commit; end ; /

create or replace procedure c_insert_cs( c_cs_class in cs.cs_class%type, c_state_values out number) as begin

select 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_name in sub.sub_teacher_name%type, s_state_values out number) as begin

insert 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; exception when 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_values out number) as begin

select count(*) into c_state_values from sub where 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,