Skip to content
We areTOP 1%

What is a functional dependency, and what is attribute closure?

MediumConceptNormalization
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

A functional dependency (FD) X -> Y means that the value of X determines the value of Y: any two rows with the same X must have the same Y. For example, roll -> name, because one roll number belongs to one student.

  • Trivial FD: Y is a subset of X, such as {roll, name} -> name. Non-trivial FDs are the useful ones.
  • Armstrong's axioms derive new FDs: reflexivity, augmentation (X -> Y gives XZ -> YZ) and transitivity (X -> Y and Y -> Z give X -> Z).
  • The closure X+ is the set of all attributes that X determines. If X+ contains every attribute, X is a super key; if, in addition, no proper subset of X is a super key, X is a candidate key.

Example: R(A, B, C, D) with A -> B, B -> C and C -> D:

  • Start with A+ = {A}. A -> B adds B, B -> C adds C, and C -> D adds D.
  • A+ = {A, B, C, D}, so A is a candidate key.
  • B+ = {B, C, D} does not contain A, so B is not a key.

More in Normalization

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account