oraclo教务管理数据库文档格式.docx
《oraclo教务管理数据库文档格式.docx》由会员分享,可在线阅读,更多相关《oraclo教务管理数据库文档格式.docx(20页珍藏版)》请在冰豆网上搜索。
是
否
college_name
学院名称
20
setting_quota
定编人数
number
4
current_quota
现在编人数
major_number
学院的专业数目
2
表2专业表(db_major)
major_no
专业编码
major_name
专业名称
是(db_college)
表3学生表(db_student)
register_no
学生学号
是(db_major)
s_name
学生姓名
s_gender
性别
s_dateofbirth
出生年月
date
s_class
班级号
1
s_address
家庭住址
s_postcode
邮政编码
6
s_mail_address
通信地址
50
s_tele
联系电话
11
s_email
电子邮箱
30
表4教师表(db_teacher)
work_id
教师编号
t_name
教师姓名
t_title
职称
t_address
t_telephone
t_position
现任职务
t_email
表5课程信息表(db_course)
course_no
课程编码
term_no
开课学期
year_no
开课学年
course_name
课程名称
credit
学分数
planned_hour
计划学时数
3
lab_hour
实验学时数
week_hour
周学时数
course_type
课程性质
exam_type
考试类别
remarks
备注
表6学生成绩表(db_grade)
学号编码
是(db_student)
是(db_teacher)
是(db_course)
registered_date
课程注册日期
registered_year
选课学年
registered_term
选课学期
final_grade
最终成绩
5
makeup_flag
补考标志
char
注:
补考标志makeup_flag的值为0或空表示没有补考,为1表示补考。
表7教学任务表(db_teach_course)
launch_year
实际开课学年
launch_term
实际开课学期
executed_plan
完成课程情况
表8教师登录账户信息表(db_faculty_per)
登录账户即教师编号
login_pwd_f
登录口令
表9学生登录账户信息表(db_student_per)
register_id
login_pwd_s
按照对学生成绩管理系统的领域知识,完成下面的内容(请将解答填写在横线上,有运行结果的请给出截图):
1、绘制出学生成绩管理系统的E_R图。
2、在现有数据库ORCL或其它数据库中创建表空间,表空间信息和表空间对应数据文件见表10和表11。
表10表空间分配
表名
所属模式
对应所属部门
对应表空间
初始大小
增长方式
学院表
staffuser
全校各学院
tbs_main
500M
自动
专业表
各学院专业
学生表
全校学生
教师表
全校教师
课程信息表
全校所有课程
教学任务表
所有专业
学生成绩表
生物工程学院
食品科学与工程学院
tbs_bio_foo
200M
信息科学与工程学院
材料科学与工程学院
tbs_infor_mati
艺术设计学院
服装学院
商务学院
tbs_art_fash_busi
表11表空间与数据文件的对应关系
表空间
类型
对应文件
文件大小
增长幅度
永久/联机
tbs_main1.dbf
250MB
10%
tbs_main2.dbf
tbs_bio_foo1.dbf
100MB
tbs_bio_foo2.dbf
tbs_infor_mati1.dbf
tbs_infor_mati2.dbf
tbs_art_fash_busi1.dbf
tbs_art_fash_busi2.dbf
tbs_teach_std
tbs_teach_std1.dbf
tbs_teach_std2.dbf
tbs_index
tbs_index1.dbf
tbs_index2.dbf
tbs_temp
临时/联机
tbs_temp1.dbf
tbs_temp2.dbf
各个表空间均创建成功,以上是局部截图
3、创建数据库用户。
学生成绩管理系统中的用户有5个:
(1)教师用户teauser:
可浏览学院、专业、课程及承担教学任务学习;
可更新自己的部分字段信息,根据学生选课注册的信息,录入所承担课程的学生成绩、查询该课程成绩,在得到教务部门的授权许可后可修改学生的成绩。
例如用户teauser对学生成绩表db_grade的更新(update)操作是在一定时间内由管理部门用户staffuser授予的,主要发生在教师录入学生成绩完毕提交后。
(2)学生用户stduser:
可对学生自己的信息、课程信息、课程成绩及教师承担的教学任务进行查询,也可修改自己的部分信息。
(3)管理部门staffuser:
拥有所有表及其全部权限。
(4)数据库管理员dbadatauser:
可对数据库表数据进行备份和恢复,完成对表的备份/恢复,表空间的备份/恢复以及用户级别备份恢复。
(5)数据库管理员dbsysuser:
可创建数据库用户,并为用户授权、创建数据库对象,创建表空间,删除数据库对象等。
以上全部用户均有执行存储过程、函数、包等数据库对象的权限。
用户表空间和表之间所属关系如图1所示。
图1用户、表空间和表之间的关系
表空间、用户和表的对应关系如表12所示。
表12表空间、用户及表的对应关系
数据库用户
拥有的表
表的默认表空间
程序对象
db_college
db_major
db_student
db_teacher
db_teach_course
db_course
触发器、存储过程、函数和包
db_grade(分区表)
dbdatauser
dbsysuser
teauser
db_faculty_per
部分应用程序对象
stduser
db_student_per
用户与表的权限关系矩阵如表13所示。
表13用户与表的权限关系矩阵
数据库用户表数据
S
SIUD
SX
SU
db_grade
SUID
表13中的权限缩写如表14所示。
表14表级权限列表
表级权限
缩写
ALTER
修改表结构
A
DELETE
删除记录
D
INDEX
索引
X
INSERT
插入数据
I
REFERENCES
关联
R
SELECT
查询
UPDATE
更新
U
请按照以上信息,给出创建5个用户的语句及其授权语句,授权语句请说明是哪个用户给哪个用户授权。
(1)staffuser用户
创建staffuser用户
createuserstaffuser
identifiedby123123
defaulttablespacetbs_main
;
alteruserstaffuserquotaunlimitedontbs_bio_foo;
alteruserstaffuserquotaunlimitedontbs_infor_mati;
alteruserstaffuserquotaunlimitedontbs_art_fash_busi;
alteruserstaffuseraccountunlock;
为用户staffuser授权
grantcreatesessiontostaffuser;
grantcreatetabletostaffuser;
grantselect,update,insert,deleteondb_collegetostaffuser;
grantselect,update,insert,deleteondb_majortostaffuser;
grantselect,update,insert,deleteondb_studenttostaffuser;
grantselect,update,insert,deleteondb_teachertostaffuser;
grantselect,update,insert,deleteondb_coursetostaffuser;
grantselectondb_gradetostaffuser;
grantselect,update,insert,deleteondb_teach_coursetostaffuser;
grantselect,update,insert,deleteondb_faculty_pertostaffuser;
grantselect,update,insert,deleteondb_student_pertostaffuser;
(2)teaser用户
创建teauser用户
createuserteauser
defaulttablespacetbs_teach_std
alteruserteauseraccountunlock;
为用户teauser授权
grantcreatesessiontoteauser;
grantselectondb_collegetoteauser;
grantselectondb_majortoteauser;
grantselect,updateondb_teachertoteauser;
grantselectondb_coursetoteauser;
grantselect,updateondb_gradetoteauser;
grantselectondb_teach_coursetoteauser;
grantselect,updateondb_faculty_pertoteauser;
(3)stduser用户
创建stduser用户
createuserstduser
alteruserstduseraccountunlock;
为用户stduser授权
grantcreatesessiontostduser;
grantselect,updateondb_studenttodbdatauser;
grantselectondb_coursetodbdatauser;
grantselect,updateondb_gradetodbdatauser;
grantselectondb_teach_coursetodbdatauser;
grantselect,updateondb_student_pertodbdatauser;
(4)dbdatauser用户
创建dbdatauser用户
createuserdbdatauser
alteruserdbdatauseraccountlock;
为用户dbdatauser授权
grantcreatesessiontodbdatauser;
grantselectondb_collegetodbdatauser;
grantselectondb_majortodbdatauser;
grantselectondb_studenttodbdatauser;
grantselectondb_teachertodbdatauser;
grantselectondb_gradetodbdatauser;
grantselectondb_faculty_pertodbdatauser;
grantselectondb_student_pertodbdatauser;
(5)dbsysuser用户
创建dbsysuser用户
createuserdbsysuser
alteruserdbsysuseraccountunlock;
为用户dbsysuser授权
grantcreatesessiontodbsysuser;
grantselect,indexondb_collegetodbsysuser;
grantselect,indexondb_majortodbsysuser;
grantselect,indexondb_studenttodbsysuser;
grantselect,indexondb_teachertodbsysuser;
grantselect,indexondb_coursetodbsysuser;
grantselect,indexondb_gradetodbsysuser;
grantselect,indexondb_teach_coursetodbsysuser;
grantselect,indexondb_faculty_pertodbsysuser;
grantselect,indexondb_student_pertodbsysuser;
4、完成如下项目,并给出运行结果的截图。
(1)以staffuser登录,创建表7个表:
db_college,db_major,db_student,db_teacher,db_course,db_grade和db_teach_course,并向表插入数据。
插入的数据见附件。
注意创建表时,需要考虑E-R图中或表1-表6中定义的主键、外键和相关约束。
数据库表
视图
数据插入
(2)使用staffuser用户登录查询“计算机科学与技术专业”学生的平均分。
selectavg(final_grade)fromsystem.db_coursec,system.db_majorm,system.db_gradeg
wherec.major_no=m.major_noandm.college_no=g.college_noandm.major_name='
计算机科学与技术'
(3)使用teauser登录,查询专业名称为“通信工程”学生的所选的课程名称。
selectcourse_namefromsystem.db_coursec,system.db_majorm
wherec.major_no=m.major_noandm.major_name='
通信工程'
5、以staffuser登录,创建一个函数fun_std_avg_gra,用于返回某个学生(以学号为参数)所选课程的数目。
并用学号“2”测试函数,给出测试结果截图。
createfunctionfu