版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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金矿安全员面试题及答案
- 人工智能在智能投研中的应用-第14篇
- 人机协同下的合规决策支持系统
- 河南漯河市临颍县第三高级中学2025-2026学年高二下学期期末考试历史试题(含答案)
- 福建龙岩市第三医院招聘2026届医学类毕业生2人考试参考题库及答案详解
- 2026四川宜宾汇发产业新空间投资有限公司第一批第二次招聘3人考试参考题库及答案详解
- 2026西安市第四十二中学招聘高中物理教师笔试备考题库及答案详解
- 2026年涪陵区黔江区住房和城乡建设局人员招聘笔试参考题库及答案详解
- 窜货联保协议书
- 《经济学导论》教学课件
- 三体系基础知识培训课件
- 建设工程施工合同GF-2024-0201住建部
- 煤矿师傅带徒弟管理制度
- 广东2025年01月广东省廉江市人力资源和社会保障局等2个单位2025年公开招考政府雇员笔试历年典型考题(历年真题考点)解题思路附带答案详解
- 高血压社区规范化管理与药物治疗
- 保险顺延申请书范本
- DBJ41-T 099-2010 河南省附属绿地绿化规划设计规范
- 《冲击波治疗骨肌疾病技术规范》
- 《火灾调查 第2版》 课件 第2章 询问
评论
0/150
提交评论