Database-Relational Mode function dependency

Source: Internet
Author: User

Logical design of relational database
For the specific problem, how to construct a data pattern suitable for it
A tool of database logic design--Normalization theory of relational database
The relationship pattern consists of five parts, that is, it is a five-tuple:

                    D, DOM, F)R:      关系名U:       组成该关系的属性名集合D:       属性组U中属性所来自的域DOM: 属性向域的映象集合F:       属性间数据的依赖关系集合
Data dependency

A constraint relationship between a relationship's internal property and a property
An abstraction of the interconnected nature of real-world properties
The intrinsic nature of the data
The embodiment of semantics
2. Types of data dependencies
function dependency (functional Dependency, précis-writers FD)
Multi-valued dependency (multivalued Dependency, précis-writers for MVD)
Other

F)    简化为一个三元组:                    F)当且仅当U上的一个关系r满足FF)的一个关系
The influence of data dependence on the relationship model
[例1]建立一个描述学校教务的数据库:    学生的学号(Sno)、所在系(Sdept)    系主任姓名(Mname)、课程名(Cname)    成绩(Grade)单一的关系模式 :   <U、F>U ={ Sno, Sdept, Mname, Cname, Grade }
   属性组U上的一组函数依赖F:    F ={ Sno → Sdept,  Sdept → Mname,                 (Sno, Cname) → Grade }

problems in the relational schema student (U, F)
1. Data redundancy is too large
2. Updating exceptions (update anomalies)
3. Insert exception (insertion anomalies)
4. Delete exception (deletion anomalies)
Conclusion:
Student relationship mode is not a good model.
"Good" mode:
Insert exception, delete exception, update exception are not occurred.
Data redundancy should be as few as possible
Cause: Caused by some data dependencies that exist in the pattern (this is also the relationship
The root cause of the decomposition of the pattern)
WORKAROUND: Eliminate inappropriate data dependencies by decomposing relational patterns

Decomposition relationship Mode
把这个单一模式分成3个关系模式:     S(Sno,Sdept,Sno → Sdept);     SC(Sno,Cno,Grade,(Sno,Cno) → Grade);     DEPT(Sdept,Mname,Sdept→ Mname)
Standardization
规范化理论正是用来改造关系模式,通过分解关系模式来消除其中不合适的数据依赖,以解决插入异常、删除异常、更新异常和数据冗余问题。最终使各关系模式达到某种程度的分离,即“一事一地”的模式设计原则
function dependency

function dependency (functional DEPENDENCY,FD)
Trivial function dependence and non-trivial function dependence
Full function dependency and partial function dependency
transitive function dependencies

   设R(U)是一个属性集U上的关系模式,X和Y是U的子集。    若对于R(U)的任意一个可能的关系r,r中不可能存在两个元组在X上的属性值相等, 而在Y上的属性值不等, 则称 “X函数确定Y” 或  “Y函数依赖于X”,记作X→Y。  
设有关系模式R(U),X和Y是属性集U的子集,函数依赖(functional dependency,简记为FD)是形为X→Y的一个命题,若对于R(U)的任意一个可能的关系r ,对r中任意两个元组t和s,都有t[X]=s[X]蕴涵    t[Y]=s[Y],那么称FD X→Y在关系模式R(U)中成立。
    1. All relationship instances must meet
    2. The concept of semantic category

For example: Name → age This function depends only on the department without
Established under the same conditions as celebrities

Trivial function dependence and non-trivial function dependence
在关系模式R(U)中,对于U的子集X和Y,如果X→Y,但Y ? X,则称X→Y是非平凡的函数依赖若X→Y,但Y ? X,   则称X→Y是平凡的函数依赖例:在关系SC(Sno, Cno, Grade)中,            非平凡函数依赖: (Sno, Cno) → Grade            平凡函数依赖:     (Sno, Cno) → Sno                                           (Sno, Cno) → Cno
若X→Y,则X称为这个函数依赖的决定属性组,也称为决定因素(Determinant)。若X→Y,Y→X,则记作X←→Y。若Y不函数依赖于X,则记作X→Y。
Full function dependency and partial function dependency
在R(U)中,如果X→Y,并且对于X的任何一个真子集X’,都有X’     Y, 则称Y对X完全函数依赖,记作     F  Y。  若X→Y,但Y不完全函数依赖于X,则称Y对X部分函数依赖,记作X   P   Y。
[例1] 中(Sno,Cno)→Grade是完全函数依赖,             (Sno,Cno)→Sdept是部分函数依赖              因为Sno →Sdept成立,且Sno是(Sno,Cno)的真子集
transitive function dependencies
 in R (U), if x  →y , (y ?  X ), y  →x  y  →z , Z  ∈y , then z  to X    The  transitive function dependency. Recorded as: x  →z  Note: if Y  →x , x  ← → y , z  directly depends on X . Example: In the relationship std  (Sno, Sdept, mname), there are: sno→sdept,sdept→mname mname transfer function dependent on Sno 

Database-Relational mode function dependency

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.