Databases & SQL Schema Design Interview Questions
Reviewed by Mark Dickie · Last updated
Database schema design is the process of defining how data is organized into tables, columns, relationships, and constraints within a relational database. For interviews, you should be able to walk through normal forms up to 3NF, choose appropriate primary and foreign keys, and explain when denormalization makes sense for read-heavy workloads. Expect questions on indexing strategy, join performance, and trade-offs between normalization and query speed. You may also be asked to model a real-world scenario from scratch, defending each design decision.
| Concept | What an interviewer checks |
|---|---|
| Normalization (1NF–3NF) | Can you eliminate redundancy and update anomalies? |
| Primary & foreign keys | Do you pick stable, narrow keys and enforce referential integrity? |
| Indexing | Can you choose between B-tree, composite, and covering indexes for a query? |
| Denormalization | Can you name the read pattern that justifies a duplicate column? |
| Constraints | Do you use NOT NULL, UNIQUE, and CHECK to protect data at the DB layer? |
What does a schema design interview typically cover?
Most rounds start with an open-ended modeling prompt such as designing an e-commerce checkout or modeling a many-to-many enrollment system, then drill into specific decisions. The interviewer wants to see your reasoning, not just the final tables. Common follow-up areas:
- Identify entities and their cardinality (one-to-one, one-to-many, many-to-many) before writing any CREATE TABLE.
- Assign primary keys and decide between surrogate keys (auto-increment integers) and natural keys.
- Add foreign keys and confirm referential actions (CASCADE, SET NULL, RESTRICT) match the business rule.
- Apply normal forms, then selectively denormalize where a specific read pattern demands it.
- Add indexes based on actual query patterns rather than speculation, and state the write-cost trade-off.
When should you denormalize a schema?
Denormalization makes sense when a normalized schema forces expensive joins on a hot read path and the read volume is far higher than the write volume. An interviewer will expect you to name the specific query or report that benefits, quantify the read/write ratio if possible, and describe how you keep duplicated data consistent, whether through triggers, application-level writes, or scheduled sync jobs. Saying "denormalize for performance" without identifying the query is a common way candidates lose points.
Key facts
- Tarmac has 20 Databases & SQL interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 8,648 job postings asking for Databases & SQL in August 2026.
- Roles asking for Databases & SQL advertise a median base salary of US$166,400, across 1,647 job postings as of August 2026.
- Tarmac last reviewed these Databases & SQL interview questions on 14 September 2026.
At a glance
| Questions | 10 shown · 20 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | True / false, Flashcard, Multiple choice, Ordering, Fill in the blank, Multiple answer, Short answer |
What you'll review
- normalization
- foreign keys
- constraints
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
Databases & SQL/schema-design/normalization
Normalizing a database to Third Normal Form (3NF) always improves query read performance compared to keeping the data in a single denormalized table.#
Options
Show answer
False. Normalizing to 3NF often hurts read performance rather than helping it. While normalization eliminates redundancy and prevents update anomalies, queries on a normalized schema typically require multiple JOIN operations, which can be slower than scanning a single wide denormalized table. Analytics and data-warehouse systems commonly use deliberate denormalization to optimize read speed.
Normalization to 3NF reduces data redundancy and update anomalies, but it does NOT always improve read performance. Normalized schemas often require multiple JOIN operations to reassemble related data, which can be slower for read-heavy workloads than a single denormalized table scan. This is why data warehouses and analytics systems frequently use intentional denormalization (e.g., star schemas) to optimize read performance at the cost of some redundancy.
Databases & SQL/schema-design/foreign-keys
What does ON DELETE CASCADE on a foreign key do?#
Show answer
When a referenced parent row is deleted, the database automatically deletes the child rows that reference it, instead of blocking the delete or leaving orphaned rows. It is one of the referential actions (others include RESTRICT, SET NULL, and NO ACTION).
ON DELETE CASCADE keeps referential integrity by propagating a parent delete down to its children automatically. Use it deliberately — a cascade can remove far more data than intended; SET NULL or RESTRICT are safer when children should outlive or block the parent's deletion.
Databases & SQL/schema-design/normalization
A table Orders has the following functional dependencies:#
Options
Show answer
The table is currently in 2NF (the primary key is a single column, so no partial dependencies exist), but it violates 3NF because customer_name and customer_city depend on customer_id, not directly on order_id — a transitive dependency. The fix is to extract those columns into a new Customers(customer_id, customer_name, customer_city) table and keep only customer_id as a foreign key in Orders.
The table is in 2NF because its primary key is a single column (order_id), so there are no partial dependencies — every non-key attribute depends on the full key. However, it violates 3NF due to the transitive dependency order_id → customer_id → customer_name, customer_city. To reach 3NF, we decompose by extracting the transitively dependent attributes into a separate Customers table keyed by customer_id, leaving only customer_id (as a foreign key) in Orders. Option (a) is wrong about the current normal form; (c) targets the wrong attributes; (d) ignores the transitive dependency.
Databases & SQL/schema-design/normalization
Arrange the following normal forms in the correct order from least strict to most strict (i.e., from the weakest guarantee to the strongest guarantee in the standard normalization hierarchy):#
Put these in order
Show answer
The correct order from least to most strict is: 1NF → 2NF → 3NF → BCNF. Each successive form adds a stricter constraint: 1NF requires atomic column values, 2NF eliminates partial dependencies on composite keys, 3NF eliminates transitive dependencies, and BCNF tightens this further by requiring every determinant to be a candidate key.
The standard normalization hierarchy progresses from 1NF → 2NF → 3NF → BCNF. 1NF eliminates repeating groups and ensures atomic values. 2NF additionally eliminates partial dependencies on a composite primary key. 3NF additionally eliminates transitive dependencies (non-key attributes depending on other non-key attributes). BCNF is a stricter version of 3NF: every determinant must be a candidate key, closing the loophole 3NF allows for certain overlapping candidate keys.
Databases & SQL/schema-design/normalization
Complete the following statements about normalization:#
Show answer
Complete the following statements about normalization:
-
A relation is in Second Normal Form (2NF) if it is in 1NF and every non-key attribute is fully dependent on the primary key — meaning no non-key attribute relies on only a part of a composite primary key.
-
A relation violates Third Normal Form (3NF) when a non-key attribute depends on another non-key attribute, a situation called a transitive dependency.
-
BCNF (Boyce-Codd Normal Form) differs from 3NF in that it disallows any functional dependency
X → YwhereXis not a candidate key.
2NF requires full functional dependency on the entire primary key — a non-key attribute cannot depend on just a part (subset) of a composite key. 3NF is violated by transitive dependencies, where a non-key attribute A → non-key attribute B → non-key attribute C creates a chain. BCNF strengthens 3NF by mandating that the left-hand side of every non-trivial functional dependency must be a candidate key (or equivalently, a superkey), removing the exception 3NF makes for prime attributes.
Databases & SQL/schema-design/constraints
Which of these are column- or table-level integrity constraints in standard SQL?#
Options
Pick every one that applies.
Show answer
NOT NULL, CHECK, and UNIQUE are integrity constraints, but ORDER BY is not. Those three, alongside PRIMARY KEY and FOREIGN KEY, are rules the database enforces on every write. ORDER BY is a query clause that sorts a result set and constrains nothing about the stored data.
NOT NULL, CHECK, and UNIQUE (alongside PRIMARY KEY and FOREIGN KEY) are integrity constraints the database enforces on every write. ORDER BY is a query clause that sorts a result set; it constrains nothing about the stored data.
Databases & SQL/schema-design/normalization
What is database normalization, and what problem does it solve?#
Show answer
Normalization is the process of structuring tables to reduce data redundancy and avoid update anomalies, typically by splitting data into related tables linked by keys so each fact is stored in exactly one place. Storing a value once means you update it once, so the data cannot become inconsistent across duplicated copies.
Normalization removes redundancy so each piece of data lives in one place, which eliminates insertion, update, and deletion anomalies. The trade-off is that highly normalized schemas need more joins to reassemble data, which is why read-heavy systems sometimes deliberately denormalize.
Databases & SQL/schema-design/normalization
Consider relation R(A, B, C, D) with the following functional dependencies (FDs):#
Options
Show answer
The relation R satisfies 3NF but not BCNF. The dependency C → B violates BCNF because C is not a superkey (C⁺ = {C, B}, which does not cover all attributes). However, it satisfies 3NF because B is a prime attribute (part of candidate key AB), exempting C → B from the 3NF violation rule that applies only when the right-hand side is a non-prime attribute.
A relation is in BCNF if for every non-trivial functional dependency X → Y, X is a superkey. The given relation R(A, B, C, D) has FDs: AB → C, C → B, and AB → D. Check each: AB → C: AB is a superkey? AB → C and AB → D means AB determines all attributes (AB → ABCD), so yes, AB is a superkey. AB → D: same reasoning, valid. C → B: Is C a superkey? C+ = {C, B} ≠ {A,B,C,D}, so C is NOT a superkey. Therefore C → B violates BCNF. This relation is in 3NF (because B is a prime attribute — it's part of the candidate key AB), but NOT in BCNF. The relation is NOT in 4NF either because it first fails BCNF, and 4NF requires BCNF. The correct answer is 3NF but not BCNF.
Databases & SQL/schema-design/normalization
The following table stores e-commerce order data and has a composite primary key of (OrderID, ProductID):#
Show answer
There are two partial dependencies that violate 2NF: (1) OrderID → CustomerName — CustomerName depends only on part of the composite key, and (2) ProductID → UnitPrice — UnitPrice depends only on the other part. The correct 2NF decomposition creates three tables: Orders(OrderID, CustomerName), Products(ProductID, UnitPrice), and OrderItems(OrderID, ProductID, Quantity). OrderItems retains only the attribute (Quantity) that fully depends on the composite key.
Second Normal Form (2NF) requires that every non-prime attribute is fully functionally dependent on the entire candidate key — no partial dependencies are allowed. In the original Orders table, the primary key is (OrderID, ProductID). CustomerName depends only on OrderID (a partial dependency), and UnitPrice depends only on ProductID (another partial dependency). Quantity depends on the full composite key and stays put. To reach 2NF, remove the partial dependencies into their own tables: Orders(OrderID, CustomerName) captures the order-to-customer mapping (OrderID is its primary key), Products(ProductID, UnitPrice) captures the product pricing, and OrderItems(OrderID, ProductID, Quantity) holds the fully-dependent attribute. Naming the first table 'Orders' rather than 'Customers' is correct because OrderID — an order identifier — is the primary key.
Databases & SQL/schema-design/normalization
Arrange the following normal forms in strictly increasing order of strength (weakest to strongest), as defined by the set of relations each form admits being a proper subset of the previous:#
Put these in order
Show answer
The correct order from weakest to strongest is: 1NF → 2NF → 3NF → BCNF → 4NF → 5NF. Each successive form eliminates a new class of anomaly: 1NF removes repeating groups, 2NF removes partial key dependencies, 3NF removes transitive dependencies on non-prime attributes, BCNF strengthens 3NF by requiring all determinants to be superkeys, 4NF removes multi-valued dependency redundancy, and 5NF (PJNF) eliminates join dependencies not entailed by candidate keys.
The correct order reflects the formal progression of normal forms from weakest (1NF) to strongest relevant to FD/MVD/JD theory. 1NF eliminates repeating groups. 2NF removes partial dependencies on any candidate key. 3NF further removes transitive dependencies on non-prime attributes. BCNF strengthens 3NF by requiring every determinant to be a superkey (no prime-attribute exception). 4NF eliminates non-trivial multi-valued dependencies not implied by a superkey. 5NF (PJNF) eliminates join dependencies not implied by candidate keys — the strongest of the standard sequence. DKNF is a theoretical form beyond 5NF but is not universally considered part of the standard progression, so it is excluded here.
Sources
The official documentation these questions are checked against:
Related interview questions
Job market
See databases-sql salaries and hiring demand from live job postings.
The other 10 questions
This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 10 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan