版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 口腔修复数字化制作流程方案
- 住宅小区景观项目前期施工方案
- 直埋供热管道施工技术指南
- 2026年注册安全工程师考试《安全生产管理》预测试卷
- 室外小区给排水管网配套工程施工方案
- 2026年证券专业水平评价测试历年真题精讲与模拟
- 2026年卫生专业技术资格考试《护理学》专项训练试卷三套
- 社区居家养老服务机构安全管理方案
- 排水管道工程现场检测报告
- 建筑外墙清洗文明施工方案
- BRCGS Food Safety Issue 9 全球食品安全标准培训课件
- (全套表格可用)SL631-2025年水利水电工程单元工程施工质量检验表与验收表
- 2025-2026学年福建省厦门一中八年级(上)期中数学试卷
- DBJ08-232-98 道路交通管理设施施工及验收规程
- 防爆电气设备检修安全规范
- DB11T 1080-2014 硬泡聚氨酯复合板现抹轻质砂浆外墙外保温工程施工技术规程
- (正式版)DB65∕T 4174-2018 《橡胶草膜下滴灌栽培技术规程》
- 城市管理的面试题及答案
- 2025年医院三基三严试题题库(附答案)
- 《热泵技术与应用》课件(共八章)
- 第三章物质的性质与转化论证重污染天气“汽车限行”的合理性探讨社会性科学议题教学设计-高一上学期化学鲁科版
评论
0/150
提交评论