CS FundamentalsModerateAccenture · Capgemini pattern
A poorly designed table stores repeating groups as separate columns: Student(sid, sname, course1, course2, course3). What specific 1NF violation does this exhibit, and what is the standard fix?
- A. It violates 4NF only, not 1NF
- B. It violates referential integrity, which is unrelated to normal forms
- C. It isn't actually a 1NF violation, since every column still holds a single value
- D. It violates 1NF's spirit of a fixed, known set of atomic columns representing a repeating multivalued fact (a student's courses) as several ad hoc columns instead of separate rows; the fix is to create a separate Enrollment(sid, course) table with one row per (student, course) pair
Correct answer: D. It violates 1NF's spirit of a fixed, known set of atomic columns representing a repeating multivalued fact (a student's courses) as several ad hoc columns instead of separate rows; the fix is to create a separate Enrollment(sid, course) table with one row per (student, course) pair
Although each course1/course2/course3 cell holds a single atomic value, encoding a variable, repeating multivalued fact as a fixed, arbitrary number of columns is exactly the 'repeating group' anti-pattern 1NF is meant to rule out: it caps the number of courses, wastes space with unused columns, and makes queries like 'which students take course X' awkward. The fix is a separate table with one row per (student, course) pair.
More DBMS and SQL questions
- A relation R(A, B, C, D) decomposes into R1(A, B) and R2(A, C, D). For this decomposition to be DEPENDENCY PRESERVING, what must hold?
- Decomposing R(A, B, C) with FDs A → B and B → C into BCNF can require R1(A, B) and R2(B, C). Is this decomposition dependency-preserving?
- A relation R(A, B, C) has FDs A → B and A → C, but NOT B → C or C → B (B and C are independent given A). Decomposing R into R1(A, B) and…
- A relation R(A, B, C, D) has only the FD A → B (C and D are independent, part of the key). Decomposing R into R1(A, C) and R2(B, D) — is…
- A SERIALIZABLE transaction in PostgreSQL (which uses Serializable Snapshot Isolation, SSI) can occasionally abort with a serialization…
- A table has a UNIQUE constraint on (email) and a separate UNIQUE constraint on (phone). An application inserts a row where email already…