Skip to content
GATEiit

GATE DA · Database Management and Warehousing

Integrity constraints and normal forms

Domain, key and referential integrity constraints, functional dependencies, attribute closure, candidate keys, minimal covers, the normal forms 1NF to BCNF, and lossless, dependency-preserving decomposition.

Before you start

  • Relations, keys and natural join →

    Normal forms are defined in terms of keys, and lossless decomposition is about natural joins.

  • ER model →

    A good ER mapping already avoids many redundancies that normalisation removes.

  • Sets and subsets

    Closures, superkeys and minimal keys are set computations.

This topic comes before: Data warehouse modelling: schemas for multidimensional data models

Concept notes

1. Integrity constraints

Integrity constraints are rules every legal database state must satisfy. The DBMS checks them on each insert, update and delete.

  • Domain constraint: each value comes from the attribute's domain (type, range, CHECK conditions). NOT NULL is a domain-style constraint.
  • Key constraint: no two tuples agree on a candidate key (UNIQUE / PRIMARY KEY).
  • Entity integrity: a primary key attribute can never be NULL.
  • Referential integrity: a foreign key value must either match the primary key (or a unique key) of some tuple in the referenced relation, or be entirely NULL.

Which operations can violate referential integrity? Inserting into, or updating the foreign key of, the referencing relation; deleting from, or updating the key of, the referenced relation. Inserting into the referenced relation never violates it.

Actions on a violating delete or update of a referenced tuple:

Action Effect on referencing tuples
RESTRICT / NO ACTION the delete is rejected
CASCADE referencing tuples are deleted (or updated) too, recursively
SET NULL foreign key set to NULL
SET DEFAULT foreign key set to its default value

With CASCADE on a self-referencing table, a delete can spread down a whole chain of tuples.

2. Functional dependencies and attribute closure

A functional dependency (FD) X→Y holds in R if any two tuples that agree on X also agree on Y. It is trivial if Y⊆X.

Armstrong's axioms (sound and complete):

  • Reflexivity: if Y⊆X then X→Y.
  • Augmentation: if X→Y then XZ→YZ.
  • Transitivity: if X→Y and Y→Z then X→Z.

Derived rules: union (X→Y,X→Z⇒X→YZ), decomposition (X→YZ⇒X→Y), pseudo-transitivity (X→Y,WY→Z⇒WX→Z). Note: XY→Z does not give X→Z.

Attribute closure X+: start with X; repeatedly, for each FD L→R with L⊆X+, add R. Stop when nothing changes. X→Y follows from F iff Y⊆X+.

Finding candidate keys:

  1. Attributes that appear on no right-hand side must be in every key. Compute their closure; if it is all of R, that is the only key.
  2. Otherwise add other attributes one at a time (then two at a time, ...) and keep the minimal sets whose closure is R.

An attribute is prime if it belongs to some candidate key, otherwise non-prime.

3. Minimal cover and equivalence of FD sets

Two FD sets F and G are equivalent if each implies every FD of the other (F+=G+). Check: for each X→Y in G, compute X+ under F and confirm Y⊆X+; then the other way round.

A minimal (canonical) cover of F is an equivalent set with:

  1. a single attribute on every right-hand side;
  2. no extraneous attribute on any left-hand side;
  3. no redundant FD.

Procedure:

  1. Split right sides: A→BC becomes A→B, A→C.
  2. For each FD XA→B, the attribute A is extraneous if B∈X+ (closure under the current set). Then replace with X→B.
  3. For each FD X→B, remove it if B is still in X+ computed without that FD.

Do step 2 before step 3. A set can have more than one minimal cover, so in an MCQ check each option for equivalence rather than expecting one fixed answer.

Minimal covers are the input to the 3NF synthesis algorithm: one relation per FD group, plus a key relation if no relation contains a candidate key.

4. Normal forms: 1NF, 2NF, 3NF, BCNF

Normal forms limit redundancy and update anomalies (insertion, deletion and modification anomalies).

Form Condition
1NF every attribute value is atomic (no lists, no repeating groups)
2NF 1NF + no partial dependency: no non-prime attribute depends on a proper subset of a candidate key
3NF for every non-trivial X→A: X is a superkey or A is prime
BCNF for every non-trivial X→A: X is a superkey

Each form implies the ones above it: BCNF ⇒ 3NF ⇒ 2NF ⇒ 1NF.

Quick facts:

  • If every candidate key is a single attribute, a 1NF relation is in 2NF.
  • If every attribute is prime, the relation is in 3NF.
  • A relation with two attributes is always in BCNF.
  • 3NF forbids transitive dependencies of non-prime attributes on a key (key→X→A with X not a superkey, A non-prime).

Finding the highest normal form: find all candidate keys, mark prime attributes, then test each FD from BCNF downwards. The first FD that fails BCNF decides whether you drop to 3NF, 2NF or 1NF.

Normal forms as nested sets1NF: atomic values2NF: no partial dependency of a non-prime attribute on a key3NF: X → A needs X superkey or A primeBCNF: X → A needs X superkeystricter inside
Every BCNF relation is in 3NF, every 3NF relation is in 2NF, and so on.

5. Decomposition: lossless join and dependency preservation

A decomposition of R into R1,…,Rk should be:

Lossless (non-additive) join: joining the pieces gives back exactly R, never extra (spurious) tuples. For a binary decomposition into R1 and R2, it is lossless iff (R1∩R2)→R1or(R1∩R2)→R2, i.e. the common attributes form a superkey of at least one piece. If they share no attribute, the join is a Cartesian product and the decomposition is lossy (unless one side is trivial).

Dependency preserving: (F1∪⋯∪Fk)+=F+, where Fi is the set of FDs of F+ that use only attributes of Ri. Then every FD can be checked inside a single relation without joins.

Target Lossless? Dependency preserving?
3NF (synthesis) always achievable always achievable
BCNF always achievable not always

Classic example: R(S,C,T) with SC→T and T→C. Keys are SC and ST; all attributes are prime, so R is in 3NF, but T→C violates BCNF. The BCNF split (T,C), (S,T) is lossless (common T→C) but loses SC→T.

BCNF decomposition: pick a violating X→Y; split into X+ and X∪(R−X+); repeat on each piece.

Formulas to remember

FD implied by a set
F⊨X→Y  ⟺  Y⊆X+
Superkey test
X is a superkey of R  ⟺  X+=R
Lossless binary decomposition
(R1∩R2)→R1 or (R1∩R2)→R2
3NF condition
X→A non-trivial⇒X superkey or A prime
BCNF condition
X→A non-trivial⇒X superkey
Dependency preservation
(⋃iFi)+=F+

Common mistakes

  • Calling an FD a 2NF violation when the determinant is not part of any key; that is a transitive dependency (a 3NF violation).
  • Checking 2NF or 3NF against only one candidate key; prime means 'in some candidate key'.
  • Splitting a left side: XY → Z does not imply X → Z.
  • Assuming BCNF decomposition always preserves dependencies.
  • Testing losslessness by whether the pieces cover all attributes; the common attributes must be a key of one piece.
  • Thinking inserts into the referenced (parent) table can violate referential integrity; only child inserts and parent deletes or key updates can.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Candidate keys and the highest normal form

numerical

R(A,B,C,D,E) with F={AB→C, C→D, D→B, D→E}. Find all candidate keys and the highest normal form of R.

  1. Step 1: Which attributes must be in every key?

    Try it on paper first.

Example 2: Minimal cover

numerical

Find a minimal cover of F={A→BC, B→C, AB→D}.

  1. Step 1: Split the right-hand sides.

    Try it on paper first.

Example 3: Lossless check and BCNF decomposition

numerical

R(A,B,C,D) with F={A→B, C→D}. Find the key, then decompose R into BCNF.

  1. Step 1: Find the key.

    Try it on paper first.

Example 4: 3NF but not BCNF

conceptual

R(S,C,T): student, course, teacher, with SC→T (a student has one teacher per course) and T→C (each teacher teaches one course). Find the highest normal form and say what a BCNF decomposition costs.

  1. Step 1: Find the keys.

    Try it on paper first.

Previous year questions

6 official GATE DA questions on this topic, newest first.

Practise these 6 PYQs →

Topic test

10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.