版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 人防工程建设技术方案及施工指导
- 路面工程应对暴雨防汛方案细则
- 多系统整合的SSO解决方案案例分析
- 制造业品质管理问题与解决方案
- 餐饮员工职业发展与技能提升方案
- 项目跟踪审计方案及具体执行流程
- 钢结构住宅楼施工方案
- 冬季基坑支护施工方案
- 装配式建筑隔音施工方案
- 篮球场场地建设方案
- 外贸进出口2025年代理报关合同协议
- 2026年包头职业技术学院高职单招职业适应性测试参考题库带答案解析
- 2024年安徽理工大学马克思主义基本原理概论期末考试模拟试卷
- 2025年医院检验科主任年终述职报告
- 2025-2026学年人教版(简谱)(新教材)初中音乐七年级(上册)期末测试卷附答案(共三套)
- 2025年大学(森林保护)森林病理学期末试题及答案
- DB35∕T 1844-2019 高速公路边坡工程监测技术规程
- 稽核培训ppt课件
- 湖南古建筑地图最终排版稿11娄底
- 沪市PROP系统查询业务介绍
- 结构化面试技巧(完整版).ppt
评论
0/150
提交评论