版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实验一数据库设计实验名称:数据库设计实验内容:以所在学校选课和课程管理为实际应用背景,设计一个教学管理数据库。假设至少包含以下需求:学生信息管理;课程信息管理;教师信息管理;学生选修课程及成绩信息管理;教师负责课程和讲授课程信息管理。实验目的: 通过实践,掌握本章介绍的数据库设计方法。 学会使用powerdesigner来完成数据库设计过程。实验方法(或程序源代码):(1)、根据实验内容明确要完成的系统功能。(2)、运行powerdesigner创建概念数据模型转换成逻辑数据模型,建立实体、属性和联系。对关键字、空值、域完整性等做出必要的描述,根据实际情况确定联系的类型。(3)、将检查无误的概
2、念数据类型转换成逻辑数据模型,并对生成的逻辑数据模型作必要的修改。(4)、选择一个实际的dbms软件根据逻辑数据模型生成物理数据模型,并对生成的物理数据模型作必要的修改。实验数据、结果分析、总结问题:(1)学生选课系统扥e-r图(2)概念数据模型图如下(3)逻辑数据模型图如下(4)物理数据模型图如下(5)系统生成的代码为:if exists(select 1 from sys.sysforeignkey where role='fk_教授课程_relations_学生') then alter table 教授课程 delete foreign key fk_教授课程_rela
3、tions_学生end if;if exists(select 1 from sys.sysforeignkey where role='fk_教授课程_relations_教师') then alter table 教授课程 delete foreign key fk_教授课程_relations_教师end if;if exists(select 1 from sys.sysforeignkey where role='fk_负责课程_relations_课程') then alter table 负责课程 delete foreign key fk_负责课
4、程_relations_课程end if;if exists(select 1 from sys.sysforeignkey where role='fk_负责课程_relations_教师') then alter table 负责课程 delete foreign key fk_负责课程_relations_教师end if;if exists(select 1 from sys.sysforeignkey where role='fk_选修课程_relations_学生') then alter table 选修课程 delete foreign key
5、fk_选修课程_relations_学生end if;if exists(select 1 from sys.sysforeignkey where role='fk_选修课程_relations_课程') then alter table 选修课程 delete foreign key fk_选修课程_relations_课程end if;if exists( select 1 from sys.systable where table_name='学生' and table_type in ('base', 'gbl temp'
6、;) then drop table 学生end if;if exists( select 1 from sys.systable where table_name='教师' and table_type in ('base', 'gbl temp') then drop table 教师end if;if exists( select 1 from sys.systable where table_name='教授课程' and table_type in ('base', 'gbl temp')
7、 then drop table 教授课程end if;if exists( select 1 from sys.systable where table_name='课程' and table_type in ('base', 'gbl temp') then drop table 课程end if;if exists( select 1 from sys.systable where table_name='负责课程' and table_type in ('base', 'gbl temp')
8、 then drop table 负责课程end if;if exists( select 1 from sys.systable where table_name='选修课程' and table_type in ('base', 'gbl temp') then drop table 选修课程end if;create table 学生 ( 学号 char(8) not null, 院系 smallint null, 姓名 char(10) null, 性别 char(2) null, 生源 char(6) null, 状态 char(4)
9、null, constraint pk_学生 primary key (学号);create table 教师 ( 教师编号 char(8) not null, 院系 smallint null, 姓名 char(10) null, 性别 char(2) null, 职称 char(6) null, 专业 char(10) null, constraint pk_教师 primary key (教师编号);create table 教授课程 ( 教师编号 char(8) not null, 学号 char(8) not null, constraint pk_教授课程 primary key
10、(教师编号, 学号);create table 课程 ( 课程编号 char(8) not null, 课程名称 char(20) null, 责任教师 char(8) null, 学时 smallint null, 课程性质 char(10) null, constraint pk_课程 primary key (课程编号);create table 负责课程 ( 教师编号 char(8) not null, 课程编号 char(8) not null, constraint pk_负责课程 primary key (教师编号, 课程编号);create table 选修课程 ( 课程编号
11、char(8) not null, 学号 char(8) not null, 成绩 smallint null, constraint pk_选修课程 primary key (课程编号, 学号);alter table 教授课程 add constraint fk_教授课程_relations_学生 foreign key (学号) references 学生 (学号) on update restrict on delete restrict;alter table 教授课程 add constraint fk_教授课程_relations_教师 foreign key (教师编号) re
12、ferences 教师 (教师编号) on update restrict on delete restrict;alter table 负责课程 add constraint fk_负责课程_relations_课程 foreign key (课程编号) references 课程 (课程编号) on update restrict on delete restrict;alter table 负责课程 add constraint fk_负责课程_relations_教师 foreign key (教师编号) references 教师 (教师编号) on update restrict on delete restrict;alter table 选修课程 add constraint fk_选修课程_relations_学生 foreign key (学号) references 学生 (学号) on update restrict on
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- ITIL 4 信息技术服务管理最佳实践培训课件
- JJG 1036-2022 电子天平检定规程培训课件
- 防范医疗事故培训
- 足球知识竞答
- 足浴店营销培训
- 防疫卫生健康知识
- 防灾减灾救灾知识技能教育
- 防火知识课件
- 防火安全知识
- 防溺水救生员培训
- 2026年1月浙江省高考(首考)地理试题(含答案)
- 2025年医院检验科主任年终述职报告
- 全屋微水泥施工方案
- 《中国金融学》课件 第4章 信用形式与信用体系-课件
- 医用Mg-Zn-Mn合金:制备、强化工艺与性能的深度剖析
- 院长发现再审申请书范文
- 国家教育事业发展“十五五”规划纲要
- SAP-CO-PC-生产成本核算配置与操作
- 2025北京自愿离婚协议书
- 新教材人教版高中化学必修第一册单元测试题及答案
- 人教版三年级语文下册-必背内容
评论
0/150
提交评论