Integrity constraints, functional dependencies, attribute closure and keys, and the normal forms 1NF, 2NF, 3NF and BCNF with lossless and dependency-preserving decomposition, as GATE tests them.
Closures, superkeys and candidate keys are all subset arguments over the attribute set.
Concept notes
1. Integrity constraints
An integrity constraint is a rule every legal database state must satisfy. The DBMS rejects (or repairs) any insert, update or delete that breaks it.
Domain constraint: each value comes from the attribute's domain (type, range, CHECK, NOT NULL).
Key constraint: no two tuples agree on a candidate key (UNIQUE, PRIMARY KEY).
Entity integrity: no attribute of the primary key may be NULL.
Referential integrity: a foreign key value in the referencing relation must either be NULL or match a primary key value in the referenced relation.
Functional dependencies are also constraints; they drive normalisation.
Which operations can break referential integrity?
Operation
Referencing (child) table
Referenced (parent) table
Insert
Can violate
Safe
Delete
Safe
Can violate
Update of key/FK
Can violate
Can violate
On a violating delete in the parent, SQL lets you choose: RESTRICT/NO ACTION (reject), CASCADE (delete matching child rows too, which can chain further), SET NULL or SET DEFAULT. A self-referencing foreign key with ON DELETE CASCADE deletes a whole subtree, a common GATE trap.
2. Functional dependencies, closure and keys
A functional dependency (FD) holds if any two tuples that agree on also agree on . It is trivial if .
Attribute closure : start with ; whenever some has , add ; repeat until nothing changes. follows from exactly when .
Superkey: contains all attributes.
Candidate key: a minimal superkey (no proper subset is a superkey).
Prime attribute: belongs to some candidate key.
Finding all candidate keys quickly:
Attributes that never appear on any right side must be in every key. Call this core .
If is everything, is the only key.
Otherwise add attributes that appear on right sides, smallest sets first, and keep only minimal superkeys.
If a relation with attributes has exactly one candidate key of attributes, it has superkeys. With several keys, count by inclusion–exclusion.
3. Minimal cover and equivalence
Two FD sets and are equivalent if each implies the other: every FD of follows from (check with closures under ) and vice versa.
A minimal (canonical) cover of is an equivalent set with no redundancy. Build it in three passes:
Split right sides so each FD has one attribute on the right: becomes , .
Remove extraneous left attributes: in , drop if (closure under the current set).
Remove redundant FDs: drop if is still in computed without that FD.
Do step 2 before step 3; the reverse order can leave redundancy. A minimal cover need not be unique, but every minimal cover is equivalent to .
Why GATE cares: the 3NF synthesis algorithm starts from a minimal cover, and many questions ask "which set is equivalent to " or "which FD is redundant". In each case the tool is the same: attribute closure.
4. The normal forms 1NF to BCNF
Normal forms limit redundancy and update anomalies (insert, delete, modify). Check them against all FDs that hold, which for a single relation means the given is enough.
Form
Condition
1NF
Every attribute value is atomic (no sets or repeating groups)
2NF
1NF and no partial dependency: no non-prime attribute depends on a proper subset of a candidate key
3NF
For every nontrivial : is a superkey or is prime
BCNF
For every nontrivial : is a superkey
Each form implies the previous one: BCNF ⊂ 3NF ⊂ 2NF ⊂ 1NF.
Quick facts:
A relation whose candidate keys are all single attributes is automatically in 2NF.
If every attribute is prime, the relation is in 3NF.
Every relation with two attributes is in BCNF.
3NF but not BCNF needs an FD where is not a superkey but is prime, e.g. overlapping candidate keys.
4NF goes beyond FDs: for every nontrivial multivalued dependency , is a superkey.
To find the highest normal form: find all keys, mark prime attributes, then test each FD against BCNF, then 3NF, then 2NF.
Every BCNF relation is in 3NF, every 3NF relation is in 2NF, and so on outward.
5. Decomposition: lossless join and dependency preservation
Normalising splits into . Two properties matter.
Lossless join: joining the pieces gives back exactly , no spurious tuples. For two pieces the test is
that is, the common attributes form a superkey of at least one piece. If the pieces share no attribute, the join is a cross product and is lossy. For three or more pieces, use the chase (tableau) test or merge two lossless pieces at a time.
Dependency preservation: let be the FDs of that use only attributes of . The decomposition preserves dependencies if . Practical test: for each in , compute using only the projected FDs and check is reached.
Goal
Lossless?
Dependency preserving?
3NF synthesis
Always
Always
BCNF decomposition
Always
Not always
So BCNF can force you to lose a dependency, while 3NF never does. That is the standard reason a designer may settle for 3NF.
Formulas to remember
Superkey testClosure of under contains every attribute
FD implication
BCNF condition
3NF condition
Binary lossless-join test
Superkeys with one candidate key attributes, single candidate key of attributes
Common mistakes
Checking 2NF against only one candidate key: a partial dependency on any candidate key breaks 2NF.
Calling an attribute non-prime because it is not in the primary key; prime means it appears in some candidate key.
Removing redundant FDs before removing extraneous left-side attributes when building a minimal cover.
Assuming BCNF decomposition preserves every dependency; only lossless join is guaranteed.
Declaring a decomposition lossless just because the pieces share an attribute; the shared attributes must be a superkey of one piece.
Forgetting that ON DELETE CASCADE chains through a self-referencing foreign key.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Candidate keys and highest normal form
numerical
with . Find all candidate keys and the highest normal form of .
Step 1: Which attributes never appear on a right side?
Try it on paper first.
Example 2: BCNF decomposition that loses a dependency
numerical
with . Decompose into BCNF and check whether the decomposition is lossless and dependency preserving.
Step 1: Find the candidate keys.
Try it on paper first.
Example 3: Finding a minimal cover
numerical
Find a minimal cover of .
Step 1: Split right sides.
Try it on paper first.
Example 4: Which operations can break referential integrity?
conceptual
Dept(dno, dname) is referenced by Emp(eid, name, dno) through the foreign key Emp.dno. Which of these can violate referential integrity: inserting into Emp, inserting into Dept, deleting from Emp, deleting from Dept?
Step 1: Think about the child table Emp.
Try it on paper first.
Previous year questions
19 official GATE CSE questions on this topic, newest first.
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 CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.