ποΈ SQL Β· Topic 18 of 20
Normalization & Design β SQL Questions with Answers
30 practice questions on Normalization & Design, each with the correct answer and a clear explanation of why it is right. Read through them as revision notes, or take this topic as an interactive quiz to test yourself.
0 easy Β· 16 medium Β· 14 hard Β· Part of SQL: Databases from basics to window functions - 20 topics.
Medium questions (16)
Q1. medium
What is normalization?
- A Organising tables to reduce redundancy and prevent update anomalies
- B Making all values lowercase
- C Sorting data
- D Backing up the database
Answer: A β Organising tables to reduce redundancy and prevent update anomalies
Normalization splits data into related tables so each fact is stored once. This avoids duplication and the inconsistencies that arise when the same fact lives in many places.
NormalizationDesign
Q2. medium
What is a data redundancy problem?
- A The same information stored in multiple places, risking inconsistency when one copy changes
- B Too many tables
- C Missing indexes
- D Slow queries
Answer: A β The same information stored in multiple places, risking inconsistency when one copy changes
If a customer's address is copied into every order row, changing it means updating many rows - and missing one leaves conflicting data. Normalization stores it once.
RedundancyAnomalies
Q4. medium
What does First Normal Form (1NF) require?
- A Atomic (indivisible) values - no repeating groups or multiple values in one cell
- B A primary key only
- C No foreign keys
- D All numeric columns
Answer: A β Atomic (indivisible) values - no repeating groups or multiple values in one cell
1NF forbids storing '555-1234, 555-5678' in one phone column, or columns like phone1, phone2, phone3. Each cell holds one value; repeating data moves to its own table.
1NFAtomicity
Q7. medium
A common summary of 3NF is 'every non-key column depends on...'
- A the key, the whole key, and nothing but the key
- B any column
- C the first column
- D no columns
Answer: A β the key, the whole key, and nothing but the key
This memorable phrase captures 1NF (atomic, tied to the key), 2NF (the WHOLE key), and 3NF (NOTHING BUT the key). It is a handy design checklist.
3NFDesign rule
Q8. medium
What is denormalization?
- A Deliberately adding redundancy back to improve read performance, accepting the update cost
- B A design mistake always
- C Removing all tables
- D The same as normalization
Answer: A β Deliberately adding redundancy back to improve read performance, accepting the update cost
Sometimes storing a pre-computed total or a duplicated label speeds up heavy read workloads (reporting, analytics). It trades write complexity and consistency risk for read speed.
DenormalizationPerformance
Q10. medium
What is an ER (Entity-Relationship) diagram?
- A A visual model of entities (tables), their attributes, and the relationships between them
- B A query plan
- C An index structure
- D A backup format
Answer: A β A visual model of entities (tables), their attributes, and the relationships between them
ER diagrams are the blueprint for a schema: boxes for entities, lines for relationships (one-to-many, many-to-many), and crow's-foot notation for cardinality. Design before you build.
ER diagramModelling
Q11. medium
How is a one-to-many relationship implemented?
- A Put a foreign key on the MANY side referencing the ONE side
- B A junction table
- C Two primary keys
- D Duplicate the data
Answer: A β Put a foreign key on the MANY side referencing the ONE side
One customer has many orders, so orders.customer_id references customers.id. The foreign key lives on the many side - the most common relationship in databases.
One-to-manyForeign keys
Q13. medium
How is a one-to-one relationship typically implemented?
- A A shared/foreign key with a UNIQUE constraint, or by merging into one table
- B A junction table
- C Two separate databases
- D It is impossible
Answer: A β A shared/foreign key with a UNIQUE constraint, or by merging into one table
One-to-one splits optional or sensitive attributes (e.g. a user and their extended profile) into a second table sharing the key, enforced UNIQUE. Often the data could just live in one table.
One-to-oneUNIQUE
Q15. medium
What is a surrogate key in design terms?
- A An artificial identifier (like an auto-increment id) with no business meaning, used as the primary key
- B A natural business value
- C A foreign key
- D An index
Answer: A β An artificial identifier (like an auto-increment id) with no business meaning, used as the primary key
Surrogate keys are stable (they never change) and simple, which is why most designs use them. Natural keys carry meaning but can change, complicating references.
Surrogate keyPrimary key
Q17. medium
What is cardinality in a relationship?
- A How many rows on one side relate to rows on the other (one-to-one, one-to-many, many-to-many)
- B The number of columns
- C The table size
- D The index depth
Answer: A β How many rows on one side relate to rows on the other (one-to-one, one-to-many, many-to-many)
Cardinality describes the relationship's shape and drives how you implement it (foreign key placement, junction tables). ER diagrams annotate it with crow's-foot symbols.
CardinalityER diagram
Q19. medium
What problem does normalization solve when a customer changes address?
- A The address is stored once, so a single UPDATE fixes it everywhere - no missed copies
- B It makes the address unchangeable
- C It duplicates the address
- D Nothing
Answer: A β The address is stored once, so a single UPDATE fixes it everywhere - no missed copies
In a denormalized design the address might be copied into every order. Normalized, it lives in one customer row, so one update keeps all data consistent.
Update anomalySingle source of truth
Q21. medium
What is a star schema?
- A A denormalized analytics design: a central fact table linked to dimension tables
- B A fully normalized design
- C A backup strategy
- D An index type
Answer: A β A denormalized analytics design: a central fact table linked to dimension tables
Data warehouses use star schemas: a fact table (sales) surrounded by dimensions (date, product, store). Deliberately denormalized for fast aggregation, unlike transactional 3NF designs.
Star schemaData warehouse
Q23. medium
Where should a derived value like order total ideally live?
- A Usually computed on read (SUM of items) to avoid it going stale - or stored/cached deliberately for performance
- B Always duplicated in every row
- C In a text file
- D It cannot be stored
Answer: A β Usually computed on read (SUM of items) to avoid it going stale - or stored/cached deliberately for performance
Storing a total risks it drifting out of sync with the items. Computing it on demand keeps it correct; caching it (with careful maintenance) is a performance-driven denormalization.
Derived dataDenormalization
Q25. medium
What is referential integrity's role in design?
- A It guarantees relationships stay valid - foreign keys always point to existing rows
- B It sorts the data
- C It compresses tables
- D It has no role
Answer: A β It guarantees relationships stay valid - foreign keys always point to existing rows
Enforced by foreign keys, it prevents orphan records (an order for a deleted customer). It is a cornerstone of trustworthy relational data.
Referential integrityForeign keys
Q27. medium
Why store status codes in a lookup table rather than free text?
- A It enforces a fixed set of valid values and lets you rename or add statuses in one place
- B It uses more space
- C It is slower
- D There is no benefit
Answer: A β It enforces a fixed set of valid values and lets you rename or add statuses in one place
Free text invites typos ('shpped', 'Shipped', 'SHIPPED') that fragment reports. A lookup table with a foreign key guarantees consistency and central control.
Lookup tableData quality
Q29. medium
What is the single source of truth principle?
- A Each fact is stored in exactly ONE place, so it is always consistent
- B One table per database
- C One user per row
- D One index per table
Answer: A β Each fact is stored in exactly ONE place, so it is always consistent
Normalization implements this principle. When a fact lives in one place, it cannot contradict itself - the core reason normalized designs are trustworthy.
Single source of truthNormalization
Hard questions (14)
Q3. hard
What are update, insert and delete anomalies?
- A Problems from redundancy: updating misses copies, you cannot insert data without unrelated data, and deleting loses needed facts
- B Syntax errors
- C Index failures
- D Types of joins
Answer: A β Problems from redundancy: updating misses copies, you cannot insert data without unrelated data, and deleting loses needed facts
For example, if course info lives only in enrolment rows, deleting the last enrolment erases the course entirely (delete anomaly). Normalization prevents these.
AnomaliesNormalization
Q5. hard
What does Second Normal Form (2NF) address?
- A Removing partial dependencies - non-key columns must depend on the WHOLE composite key, not part of it
- B Removing all keys
- C Making columns unique
- D Adding indexes
Answer: A β Removing partial dependencies - non-key columns must depend on the WHOLE composite key, not part of it
2NF applies when the primary key is composite. If a column depends on only part of the key (e.g. product_name depends on product_id alone in an order_items table), it belongs in a separate table.
2NFPartial dependency
Q6. hard
What does Third Normal Form (3NF) address?
- A Removing transitive dependencies - non-key columns must not depend on OTHER non-key columns
- B Removing the primary key
- C Combining tables
- D Adding redundancy
Answer: A β Removing transitive dependencies - non-key columns must not depend on OTHER non-key columns
If a table has employee_id (key), dept_id, and dept_name, then dept_name depends on dept_id (a non-key), not directly on the key. 3NF moves department data to a departments table.
3NFTransitive dependency
Q9. hard
When is denormalization justified?
- A For read-heavy analytics/reporting where join cost is high and data changes rarely
- B Always - normalization is bad
- C Never
- D Only for small tables
Answer: A β For read-heavy analytics/reporting where join cost is high and data changes rarely
Data warehouses often denormalize into star schemas for fast aggregation. For transactional systems that change constantly, normalized designs remain safer. It is a deliberate trade-off, not a default.
DenormalizationData warehouse
Q12. hard
How is a many-to-many relationship implemented?
- A With a junction (bridge) table holding foreign keys to both sides
- B With one foreign key
- C By duplicating rows
- D It cannot be modelled
Answer: A β With a junction (bridge) table holding foreign keys to both sides
Students and courses: an enrollments table links them, with student_id and course_id. It resolves the many-to-many into two one-to-many relationships and can carry extra data like a grade.
Many-to-manyJunction table
Q14. hard
What is a lookup (reference) table?
- A A small table of allowed values (e.g. statuses, categories) referenced by foreign key
- B A backup table
- C A temporary table
- D An index
Answer: A β A small table of allowed values (e.g. statuses, categories) referenced by foreign key
Instead of repeating 'pending'/'shipped' text everywhere, store them once in a statuses table and reference by id. This enforces valid values and makes renaming a status a one-row change.
Lookup tableNormalization
Q16. hard
Why can columns like phone1, phone2, phone3 be a design smell?
- A They violate 1NF and cap the number of phones; a separate phones table scales cleanly
- B They are always correct
- C They save space
- D They speed up queries
Answer: A β They violate 1NF and cap the number of phones; a separate phones table scales cleanly
Repeating-group columns force a fixed maximum and make queries awkward ('find anyone with this number' must check three columns). A related phones table (one row per number) is the normalized solution.
1NFRepeating groups
Q18. hard
What is a functional dependency?
- A When one column's value determines another's - e.g. zip_code determines city
- B A type of function
- C A foreign key
- D An index
Answer: A β When one column's value determines another's - e.g. zip_code determines city
Functional dependencies are the theory behind normal forms. If A determines B but A is not a key, B usually belongs in a table keyed by A - the essence of 3NF.
Functional dependency3NF
Q20. hard
What is BCNF (Boyce-Codd Normal Form)?
- A A stronger 3NF: every determinant must be a candidate key
- B Weaker than 1NF
- C The same as 2NF
- D About indexes
Answer: A β A stronger 3NF: every determinant must be a candidate key
BCNF handles edge cases 3NF misses, involving overlapping candidate keys. Most practical designs that reach 3NF are also in BCNF; it matters mainly in complex schemas.
BCNFNormal forms
Q22. hard
What is the main trade-off of a highly normalized design?
- A Less redundancy and safer writes, but more joins - which can slow complex read queries
- B It is always faster
- C It uses more storage
- D It has no downsides
Answer: A β Less redundancy and safer writes, but more joins - which can slow complex read queries
Normalization optimises for correctness and write integrity. Read-heavy analytical workloads sometimes denormalize to avoid many joins - a conscious balance between the two goals.
Trade-offsJoins
Q24. hard
How do you decide how far to normalize?
- A Aim for 3NF by default, then denormalize selectively where measured performance requires it
- B Always go to the highest normal form
- C Never normalize
- D Randomly
Answer: A β Aim for 3NF by default, then denormalize selectively where measured performance requires it
3NF is the practical sweet spot for most transactional systems: enough to prevent anomalies without excessive joins. Denormalize only with evidence that it helps a specific workload.
Design strategy3NF
Q26. hard
What is an associative entity?
- A Another name for a junction table - it represents the relationship itself and can hold its own attributes
- B A primary key
- C A view
- D An index
Answer: A β Another name for a junction table - it represents the relationship itself and can hold its own attributes
The enrollments table between students and courses is an associative entity: it exists because of the relationship and can store attributes about it, like enrolment date and grade.
Associative entityJunction table
Q28. hard
What design issue does a NULL-heavy table often reveal?
- A Attributes that apply to only some rows may belong in a separate related table (subtype)
- B The table is too small
- C Missing indexes
- D Nothing
Answer: A β Attributes that apply to only some rows may belong in a separate related table (subtype)
If many columns are NULL for most rows (e.g. car-specific fields in a generic products table), those attributes likely belong to a subtype table linked by key - a cleaner, more normalized model.
NULLSubtypesDesign
Q30. hard
Why model the schema (ER diagram) BEFORE writing CREATE TABLE?
- A Relationships and keys are hard to change once data exists; a clear model prevents costly restructuring later
- B It is required syntax
- C It makes queries run faster
- D There is no reason
Answer: A β Relationships and keys are hard to change once data exists; a clear model prevents costly restructuring later
Schema changes on populated production tables are risky and slow. Designing entities, keys and relationships upfront catches mistakes while they are cheap to fix.
ER diagramPlanning