[Database Principles] Functional dependence, trivial dependence, non-trivial dependence, complete functional dependence, partial functional dependence, transfer function dependence

1. Functional dependency

Functional dependence is a kind of data dependence, which reflects the interdependence and mutual restraint relationship between attributes or attribute groups, that is, the constraint relationship in the real world.

Let R(U) be a relational pattern on attribute U, X and Y are both subsets of U={A1, A2,..., An}, r is any relation of R, if for any two of r Tuple u, v, as long as u[X]=v[X], there is u[Y]=v[Y], then X function determines Y, or Y function depends on X, denoted as X→Y .

Simply put, there are two subset attributes X and Y on the attribute U. A tuple can be obtained from the X attribute, and the Y attribute corresponding to the X attribute gets the same tuple.

For example:
(sno-student ID, tno-teacher ID, cno-course ID, sname-student name, tname-teacher name, cname-course name, grade-score)
1. sno→sname, cno→cname, (sno, cno)→grade √
2, sname→sno, tno→cno, sno→tname × (there is no one-to-one correspondence)

2. Ordinary dependence

If X determines Y, and Y belongs to X, that is, Y is a proper subset of X, then the dependency is called a trivial dependency; otherwise, it is a non-trivial dependency.
Simply put, X can deduce that he lives a part of himself.
For example:
in the student table (student number, name, grade), (student number, name) can deduce any of the student number and name, which is a trivial functional dependency. To put it
bluntly, as long as Y is a child of X Set, Y depends on X

Non-trivial dependence: In the student table (student number, name, grade), the grade of the student can be derived through (student number, name), but the grade is not a subset of (student number, name), which is a non-trivial functional dependence .((Student ID, name) is an x, student ID or name is an x').

3. Partial functional dependency and full functional dependency

If X-> Y and X for any subset of X ' not having X ' -> Y, called Y function entirely dependent on X, Y or said function dependent on the X moiety.
For example:
completely dependent: {student student ID, elective course name} can get {the score of the student's elective course}, but the score can not be obtained through a single {student ID} or a single {elective course name} , It means that {the grade of the student's elective course} is completely dependent on {student ID, elective course name}

Partial functional dependence: {student student ID, course ID} can get {the student's name}, and {student student ID} has been able to get {the student's name}, which means that {the student's name} is partially dependent on { Student ID, Course ID}; For example, {course name} can be obtained through {Student ID, Course ID}, and {course name} can be obtained by separate {course ID}, then the {course name} part Depends on {student ID, course ID}. (Partial dependence will cause data redundancy and various abnormalities.)

Fourth, transfer function dependence

In the relationship R (student number, dormitory, cost), {student number} can get {dorm}, and {dorm} can get {cost}, and if the opposite is not true, there is a transitive dependency {study number}->{ cost}. (Transitive dependence can also cause data redundancy and various abnormalities.)

Search [Zixin] on WeChat or scan the QR code below to make friends and make progress together. The article is continuously updated.Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51656605/article/details/112513228