CS Atlas GATE 2027
DBMS course
0 / 119 complete

DBMS/Phase 4 · FDs & Normalization

Lesson 4.2.1 · Item 61 of 119

FD definition; trivial vs non-trivial; checking whether an FD holds on an instance

Read at your own pace. Try the questions before opening the answers.

On this page

0 · Recall Warm-up

Answer from memory first. Answers are in the Answer Vault at the bottom.

  1. Name the three anomalies. from Lesson 4.1.1
  2. Can a table instance prove that an attribute set is a key? from Lesson 2.2.1
  3. What is p → q equivalent to? from Lesson 0.2.3

1 · The Hook

"roll determines name": two rows with the same roll always have the same name. That sentence is a functional dependency, written roll → name. Every normal form, every key calculation and every decomposition test in this phase is built on it. GATE often starts simple: here is a table instance; which FDs hold?

2 · Predict First

ABC
1xp
1xq
2yp

Does A → B hold in this instance? Does A → C? Does C → A?

Make a guess in your head. The answer opens Section 3.

3 · Core Concept

Predict First — the answer

A → B: the two rows with A = 1 both have B = x → holds. A → C: A = 1 gives p and q → fails. C → A: C = p gives A = 1 and A = 2 → fails.

Definition

For attribute sets X and Y of R, the functional dependency X → Y holds on R if, in every valid state of R, any two tuples that agree on X also agree on Y:

for all t₁, t₂: t₁[X] = t₂[X] ⇒ t₁[Y] = t₂[Y].

Read "X determines Y" or "Y is functionally dependent on X". X is the left-hand side (determinant), Y the right-hand side.

FDs come from the meaning of the data ("each student has one name"), declared by the designer. A key is a special case: K is a superkey exactly when K → R (K determines all attributes).

Checking an FD on an instance

Group the rows by their X-values. The FD X → Y fails if some group contains two different Y-values. Otherwise it holds in this instance.

  • An instance can disprove an FD (one counter-example) but never prove it holds on the schema.
  • If no two rows share an X-value (X unique in the instance), then X → Y holds in that instance for every Y.
  • If all rows have the same Y-value, then X → Y holds in that instance for every X.

Trivial and non-trivial FDs

  • Trivial: Y ⊆ X (AB → A). Always holds, says nothing.
  • Non-trivial: Y ⊄ X (AB → C, or AB → BC).
  • Completely non-trivial: X ∩ Y = ∅ (AB → C).

Notation

Attribute sets are written without braces: AB means {A, B}; AB → CD means {A, B} → {C, D}. A set of FDs is called F.

FDs of the college tables

roll → name, roll → dept, dept → hod, cid → title, roll cid → grade. Also derived ones such as roll → hod (through dept): the next lesson shows how to derive them.

4 · Visual

Check  A -> C  on the instance:

group by A      C values in the group     verdict
A = 1           { p, q }                  two different C's -> A -> C FAILS
A = 2           { p }

Check  A -> B:
A = 1           { x }                     one value per group
A = 2           { y }                     -> A -> B holds (in this instance)

5 · Worked Examples

Example 1 Easy

Which are trivial: (a) AB → B; (b) A → A; (c) AB → BC; (d) A → B?

Solution

(a) and (b) are trivial (right side inside left side). (c) is non-trivial (C ∉ AB) but not completely non-trivial (B is shared). (d) is completely non-trivial.

Example 2 Medium

PQR
a1x
b1y
a2x
c2y

Which of P → R, Q → R, R → P, PQ → R hold in this instance?

Solution

P → R: P = a gives x, x → holds. Q → R: Q = 1 gives x, y → fails. R → P: R = x gives a, a; R = y gives b, c → fails. PQ → R: all PQ pairs are different → holds.

Example 3 GATE

On R(A, B, C) the instance has 4 rows and every row has C = 5. Which FDs with C on the right hold in this instance?

Solution

All of them: A → C, B → C, AB → C, even ∅ → C. Any two rows agree on C. (This tells nothing about the schema.)

6 · GATE Traps

  • An FD that holds in an instance may still not hold on the schema; an instance only disproves.
  • X → Y says nothing about Y → X.
  • Unique X in the instance makes X → anything hold in that instance.
  • Trivial FDs (Y ⊆ X) always hold.
  • K is a superkey ⇔ K → all attributes.

7 · Memory Hook

"Same left, same right." If two rows look the same on the left, they must look the same on the right; one mismatch kills the FD.

8 · Connect the Dots

Lesson 4.1.1 said each fact is "determined" by some attributes; this lesson made "determines" precise. Next: from a few given FDs, many others follow logically. Armstrong's axioms are the rules for deriving them.

9 · Self-Test

GATE format. Try every question before opening the vault.

Q1 · MSQ · 2 mark(s) — Instance check

Instance of R(A, B, C): (1, 2, 3), (1, 2, 4), (2, 2, 3), (3, 1, 3). Which FDs hold in this instance?

  1. (A) C → B
  2. (B) B → C
  3. (C) A → B
  4. (D) AC → B

Q2 · MCQ · 1 mark(s) — Trivial

Which FD is trivial?

  1. (A) A → B
  2. (B) AB → A
  3. (C) AB → C
  4. (D) A → AB

Q3 · MCQ · 1 mark(s) — Keys

K is a superkey of R exactly when:

  1. (A) K → K
  2. (B) K → R (all attributes)
  3. (C) K is a single attribute
  4. (D) R → K

Q4 · MCQ · 2 mark(s) — Proof

In a given instance, no two rows share a value of X. What can you conclude?

  1. (A) X is a key of the schema
  2. (B) X → Y holds in this instance for every Y
  3. (C) Nothing at all
  4. (D) X → Y holds on the schema for every Y

Q5 · NAT · 1 mark(s) — Counting

Instance of R(A, B): (1, x), (2, x), (3, y), (1, x). (Treat it as a list.) How many of the FDs A → B, B → A hold in this instance?

Numerical answer: ________

10 · Rule Card

  • X → Y: tuples agreeing on X agree on Y, in every valid state.
  • Instance check: group by X; any group with two Y-values → FD fails. Instances disprove, never prove.
  • Trivial: Y ⊆ X; non-trivial: Y ⊄ X; completely non-trivial: X ∩ Y = ∅.
  • Superkey K ⇔ K → R.

11 · Concept Ledger

Unlocked in this lesson. From here on, these terms may be used.

functional dependency (FD)determinant (left-hand side)trivial FDnon-trivial FDcompletely non-trivial FDFD set Fchecking an FD on an instance

12 · Answer Vault

Reveal answers when you’re ready

Recall Warm-up

  1. Update, insertion, deletion.
  2. No; it can only disprove it.
  3. ¬p ∨ q.

Self-Test

Q1 Answer: (C) (D) · 2 mark(s)

A → B: A = 1 gives 2, 2. B → C: B = 2 gives 3, 4, 3: fails. C → B: C = 3 gives 2, 2, 1: fails. AC → B: all AC pairs differ.

  • (A) is wrong: C = 3 has B values 2 and 1.
  • (B) is wrong: B = 2 has C values 3 and 4.

Re-read: Lesson 4.2.1 — FD definition; trivial vs non-trivial; checking whether an FD holds on an instance

Q2 Answer: (B) · 1 mark(s)

Right side contained in left side.

  • (A) is wrong: Non-trivial.
  • (C) is wrong: Non-trivial.
  • (D) is wrong: B is new: non-trivial.

Re-read: Lesson 4.2.1 — FD definition; trivial vs non-trivial; checking whether an FD holds on an instance

Q3 Answer: (B) · 1 mark(s)

Definition.

  • (A) is wrong: Trivial for any K.
  • (C) is wrong: Not required.
  • (D) is wrong: Trivial.

Re-read: Lesson 4.2.1 — FD definition; trivial vs non-trivial; checking whether an FD holds on an instance

Q4 Answer: (B) · 2 mark(s)

No pair of rows agrees on X, so no counter-example exists in this instance.

  • (A) is wrong: An instance cannot prove a key.
  • (C) is wrong: The instance-level conclusion is valid.
  • (D) is wrong: An instance cannot prove schema FDs.

Re-read: Lesson 4.2.1 — FD definition; trivial vs non-trivial; checking whether an FD holds on an instance

Q5 Answer: 1 · 1 mark(s)

A → B holds (A = 1 gives x twice). B → A fails (B = x gives 1 and 2).

Re-read: Lesson 4.2.1 — FD definition; trivial vs non-trivial; checking whether an FD holds on an instance

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.