# Functional Dependencies, Candidate Keys & Normalization (1NF–BCNF)
Exam: GATE Computer Science & Information Technology (GATE CS)
Subject: Databases (DBMS)
Canonical URL: https://gateandnet.com/exams/gate-cs/databases/functional-dependencies-and-normalization

> Attribute closure algorithm, prime vs non-prime attributes, exact definitions of 2NF/3NF/BCNF, and lossless join test.

## Normal Forms Checklist (Assume $R$ is in 1NF — Atomic Attributes)

Let $X \to A$ be any **non-trivial** functional dependency ($A \notin X$):

| Normal Form | Exact Condition on Every Non-Trivial FD $X \to A$ | Always Lossless Decomposition? | Always Dependency Preserving? |
| :--- | :--- | :---: | :---: |
| **2NF** | No **Partial Dependency** (no proper subset of a Candidate Key determines a non-prime attribute) | Yes | Yes |
| **3NF** | Either **$X$ is a Superkey** OR **$A$ is a Prime Attribute** (part of *some* Candidate Key) | ✅ **Yes** | ✅ **Yes** |
| **BCNF** | **$X$ MUST be a Superkey** (zero exceptions!) | ✅ **Yes** | ❌ **Not Always!** |

> [!TIP]
> **Instant Shortcuts for Exam Hall:**
> 1. If every Candidate Key of $R$ is a **single attribute (simple key)**, then $R$ is **automatically in 2NF**!
> 2. Any **2-attribute relation $R(A, B)$** is **ALWAYS in BCNF**!


## Solved Practice Questions & PYQs

### [GATE CS DBMS PYQ | MCQ]
Consider relation $R(A, B, C, D)$ with functional dependencies $F = \{AB \to C,\; C \to D,\; D \to A\}$. What is the highest Normal Form satisfied by $R$?
**Correct Answer:** C
**Solution:** Note $B$ never appears on any RHS, so $B$ must be in every candidate key! Computing closures gives Candidate Keys `AB`, `BC`, and `BD`. Therefore **every attribute $\{A, B, C, D\}$ is a prime attribute**! Since the RHS of $C \to D$ and $D \to A$ are prime attributes, $R$ satisfies **3NF**, and fails **BCNF** because determinants $C$ and $D$ are not superkeys.
