FD and Closure Attribute
FD and Closure Attribute
FUNCTIONAL DEPENDENCIES
– Relationship between one attribute with the other attribute
– Denoted by ->
– X & Y are attribute then X -> Y (We can say X determines Y or Y is
functionally depend on X)
– The left side of FD is known as a determinant, the right side of the
production is known as a dependent.
– If t1.x=t2.x then t1.y=t2.y
FUNCTIONAL DEPENDENCIES
• For example:
• Assume we have an employee table with attributes: Emp_Id, Emp_Name,
Emp_Address.
• Here Emp_Id attribute can uniquely identify the Emp_Name attribute of
employee table because if we know the Emp_Id, we can tell that employee
name associated with it.
• Functional dependency can be written as:
Emp_Id → Emp_Name
• We can say that Emp_Name is functionally dependent on Emp_Id.
FUNCTIONAL DEPENDENCIES
• Full Functional Dependent
A functional dependency X → Y is fully functional if removing any attribute
from X causes the dependency to no longer hold.
FUNCTIONAL DEPENDENCIES
• Partial Functional Dependent
A functional dependency X → Y is fully functional if removing any attribute
from X causes the dependency to no longer hold.
FUNCTIONAL DEPENDENCIES
– Augmentation
– If X → Y holds, then XZ → YZ also holds (adding extra attributes doesn't
change dependency).
✔ Example:
• If Student_ID → Name holds,
• Then (Student_ID, Course) → (Name, Course) also holds.
PROPERTTIES OF FUNCTIONAL DEPENDENCIES
– Transitivity
• If X → Y and Y → Z, then X → Z.
✔ Example:
• If Student_ID → Name
• And Name → Address,
• Then we can infer Student_ID → Address
PROPERTTIES OF FUNCTIONAL DEPENDENCIES
– Union
• If X → Y and X → Z, then X → YZ.
✔ Example:
• If Course_ID → Course_Name
• And Course_ID → Instructor,
• Then we can combine as Course_ID → (Course_Name, Instructor)
PROPERTTIES OF FUNCTIONAL DEPENDENCIES
– Decomposition
• If X → YZ, then X → Y and X → Z.
✔ Example:
• If Course_ID → (Course_Name, Instructor),
• Then we can say Course_ID → Course_Name
• And Course_ID → Instructor
PROPERTTIES OF FUNCTIONAL DEPENDENCIES
– Pseudotransitivity
• If X → Y and WY → Z, then WX → Z.
✔ Example:
• If Student_ID → Department
• And (Department, Course) → Instructor,
• Then (Student_ID, Course) → Instructor
PROPERTTIES OF FUNCTIONAL DEPENDENCIES
– TRIVIAL DEPENDENCIES
• Definition: If Y ⊆ X, then X → Y is trivial.
✔ Example:
• (Student_ID, Student_Name) → Student_ID
• Student_ID → Student_ID
TYPES OF FUNCTIONAL DEPENDENCIES
• Practice Problem 2
• R=(A,B,C,D,E,H)
• FD
– A->B
– BC->D
– E->C
– D->A
CANONICAL COVER OF FUNCTIONAL DEPENDENCIES
• Example 1:
• Optimizing relations/tables.
• Avoid Redundancy
• Avoid Anomalies
• Normalization is a process in database design used to eliminate
redundancy and dependency by organizing data into multiple related
tables. It improves data integrity, consistency, and efficiency by reducing
anomalies (insertion, update, and deletion anomalies).
What are Atomic Values?
• Atomic values refer to indivisible, single-valued data elements in a
database table. A column contains atomic values if each cell holds only
one value, rather than multiple values or lists.
NORMALIZATION
• Advantages of Normalization
• Normalization helps to minimize data redundancy.
• Greater overall database organization.
• Data consistency within the database.
• Much more flexible database design.
• Enforces the concept of relational integrity.
NORMALIZATION
• Disadvantages of Normalization
• You cannot start building the database before knowing
what the user needs.
• The performance degrades when normalizing the
relations to higher normal forms, i.e., 4NF, 5NF.
• It is very time-consuming and difficult to normalize
relations of a higher degree.
• Careless decomposition may lead to a bad database
design, leading to serious problems.
NORMALIZATION
• Unnormalized Data
↓ (Removing Repeating Groups)
• 1NF
↓ (Remove Partial Dependencies)
• 2NF
↓ (Remove Transitive Dependencies)
• 3NF
↓ (Make Sure Determinants are Candidate Keys)
• BCNF
↓ (Remove Multivalued Dependencies)
• 4NF
↓ (Remove Join Dependencies)
• 5NF
NORMALIZATION
FIRST NORMAL FORM