数据库6-关系数据理论讲解.ppt
文本预览下载声明
An Introduction to Database System;6.1 函数依赖;函数依赖的定义;;An Introduction to Database System;An Introduction to Database System;Example;6.2 函数依赖规则;函数依赖规则;;分解/合并规则(续);An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;计算属性的闭包;属性的闭包:
设S是关系R上的函数依赖集,A={A1,A2,…,An}是R上的属性集,属性集A在函数依赖集S下的闭包(closure)是这样一个属性集B,对于关系R的所有实例,函数依赖:A1A2…An → B 均成立,即 A1A2…An → B “逻辑蕴含于”函数依赖集S。
属性集{A1,A2,…,An}的闭包表示为{A1,A2,…,An}+。
显然:
{A1,A2,…,An}含于{A1,A2,…,An}+
若A1A2…An → X,则X含于B ;计算属性的闭包(续);Example;6.2 关系数据库模式设计;;An Introduction to Database System;关系分解;关系分解(续);An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;1NF分解为2NF范式的方法;1NF分解为2NF范式的方法;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;An Introduction to Database System;思考;Exercise ;;在关系模式STJ(S,T,J)中,S表示学生,T表示教师,J表示课程。 已知:
每一教师只教一门课,每门课由若干教师教;
某一学生选定某门课,就确定了一个固定的教师; 某个学生选修某个教师的课就确定了所选课的名称 ;
所以函数依赖集:
F={(S,J)→T,(S,T)→J,T→J}
候选码为(S,J)和(S,T)
因此STJ∈3NF
但STJ∈BCNF
将STJ分解为二个关系模式:
SJ(S,J) ∈ BCNF, TJ(T,J)∈ BCNF;设关系模式R(Sno,Cno,Grade,Tname,Taddr),其属性分别为: 学号、课程号、成绩、任课教师姓名、教师住址。如果规定:
每个学生每学一门课只有
显示全部