Functional Dependency
Functional Dependency
1. Functional Dependency
2. Multivalued Dependency
3. Join Dependency
▪ The attributes in the key play the role of X(X is a Super key), and the set
of all attributes in the relation plays the role of Y
▪ Example: let s is an instance of Relation Student.
1.To see that whether the above FDs hold or not depends on the university or college whose
database we are considering allows duplicate student names and course names.
2. If duplicate names are possible, then there is a possibility of two students having exactly the
same name, the (1) does not hold.
3.If it was an enterprise policy to have unique course names the (2) holds.
1.FDs in Entities:
Student entity:
Enrol no->Sname,Addr
Course Entity:
Cno->Cname
Instructor Entity:
Instructor->office
2.FDs in Relationship:
Enrols Relationship: many-many
Teachers Relationship:
Cno->Instructor
Instructor->Cno
Department of CSE CSEN2061 & Database Management
8/8/2024 8
Systems
Multi Valued Dependency
Formally,
Given a relation Schema R with attributes (X, Y, Z), if the MVD X->->Y holds over R and Z=R-XY,
the following must be true for every legal instance r of R:
If t1ϵr, t2ϵr and t1.X=t2.X, then there must be some t3ϵr such that t1.XY=t2.XY and t2.Z=t3.Z
A B1 C1 Tuple t1
A B2 C2 Tuple t2
A B1 C2 Tuple t3
A B2 C1 Tuple t4
In the table above, student with s_id1 has opted for two courses, Science and Maths,
and has two hobbies, Cricket and Hockey and the two records for student with s_id1,wil l
give rise to two more records, as shown below, because for one student, two hobbies
exists, hence along with both the courses, these hobbies should be specified.
Now this relation satisfies the fourth normal form. A table can also have functional
dependency along with multi-valued dependency. In that case, the functionally dependent
columns are moved in a separate table and the multivalued dependent columns are moved
to separate tables.
8/8/2024
Department of CSE CSEN2061 & Database Management
14
Systems
Join Dependency
Join Dependencies (It is a generalization of MVDs)
Definition:
A join dependency (JD) ⋈ {R1, R2,……,Rn} is said to hold over a relation R if R1, ….., Rn is a
lossless-join decomposition of R.
An MVD X->->Y over a relation R can be expressed as join dependency ⋈{XY, X(R-Y)}.
In Natural Join table we got 6 records with eno:1111 which does not exist in the original table. This problem occurred because we
lost the relationship between the project and skills by splitting the table into two projections.
Note: the original table is in 4NF but it cannot be splitted into two projections and then recombined to produce the original table,
this table can be normalized to fifth normal form(5NF).
OR
A relation schema R is said to be in fifth normal form (5NF) if, for every JD ⋈ {R1,R2, …., Rn} that holds
over R, one of the following statement is true:
𝑅𝑖 = R for some i, or
The JD is implied by the set of those FDs over R in which the left side is a key for R.
Explanation of 2nd statement:
The decomposition of R into {R1, R2, …, Rn} is lossless-join whenever the key dependencies hold. JD ⋈
{R1,R2, …., Rn} is a trivial JD if 𝑅𝑖 = R for some i; such a JD always holds.
Observe in R11, for A=1, it has two values of C (1 and 2). But in original table A =1 means C
has only one value. This indicates after joining extra tuples are added.
So, this is called lossy decomposition. Lossy does not mean that we are losing data, lossy is
in terms of tuples, after joining tables there should be no extra tuples. Data inconsistency
occurs. All the values in new table R11 are not valid.
If we apply natural join for the above tables. We get lossless decomposition, so no
redundancy.