Skip to content
Database Schema Design Interview Questions (With Answers) 7 min

Database Schema Design Interview Questions (With Answers)

ScaleDojo
ScaleDojo
•
Nov 23, 2026
•
7 min read
•1,720 words
Database Schema Design Interview Guide

Database schema design interview questions are where many strong candidates lose the round. They can draw the architecture, explain caching and sharding, and then go quiet when the interviewer says, “Now design the tables.” The good news is that the round is predictable. Interviewers ask a small set of follow-ups, and each one has a strong answer you can learn.

This guide gives you a repeatable framework, a full worked example with SQL, the six questions you will be asked, a weak and a strong answer for each, and the mistakes that cost candidates the most points.

What Interviewers Actually Test

A schema round is not graded on whether you drew the “correct” tables. There is usually no single correct schema. Interviewers look for five things:

  1. You start from the workload, not from tables. What does the product read and write most?

  2. Your keys and constraints protect the data. Rules like “one email per user” live in the database, not in hope.

  3. Every index maps to a query you can name.

  4. You know the trade-offs (normalization vs speed, relational vs document, strong vs eventual consistency).

  5. You can explain it out loud, and adapt when the requirements change.

A 6-Step Framework You Can Reuse

Use the same order every time. It keeps you calm and shows structure.

  1. Clarify requirements. Who uses it, what is the core workflow, what is out of scope? Ask about read-to-write ratio and expected growth.

  2. List the access patterns. Write down the reads and writes that matter, with filters and sort order.

  3. Identify entities and relationships. One-to-one, one-to-many, many-to-many.

  4. Choose keys and constraints. Primary keys, foreign keys, unique and check constraints.

  5. Map indexes to queries. Name the query, the filter order and the sort order for each index.

  6. Stress-test it. What happens at 100x data? What if two users update the same row? What if the requirements change?

Worked Example: An Online Store

Suppose the interviewer says: “Design the database for an online store.” Here is how steps 1 to 5 look.

Requirements (assumptions you state out loud): customers place orders containing several products; the store needs order history per customer; stock must never go negative; prices can change over time.

Access patterns:

Access pattern

Shape

Design pressure

Show one order with its items

Point read plus join

Primary key, foreign keys

List a customer’s recent orders

Filter and newest-first sort

Composite index

Reduce stock when an order is placed

Conditional write

Constraint and atomic update

Look up a product by SKU

Point read

Unique index

Entity relationship diagram showing customers, orders, order_items and products tables with primary keys, foreign keys, and one-to-many relationships.

Schema:

CREATE TABLE customers (
  customer_id BIGSERIAL PRIMARY KEY,
  email       TEXT NOT NULL UNIQUE,
  name        TEXT NOT NULL,
  created_at  TIMESTAMPTZ NOT NULL DEFAULT now()
);

CREATE TABLE products (
  product_id  BIGSERIAL PRIMARY KEY,
  sku         TEXT NOT NULL UNIQUE,
  name        TEXT NOT NULL,
  price_cents INT NOT NULL CHECK (price_cents >= 0),
  stock       INT NOT NULL CHECK (stock >= 0)
);

CREATE TABLE orders (
  order_id    BIGSERIAL PRIMARY KEY,
  customer_id BIGINT NOT NULL REFERENCES customers(customer_id),
  status      TEXT NOT NULL CHECK (status IN ('pending','paid','shipped','cancelled')),
  total_cents BIGINT NOT NULL CHECK (total_cents >= 0),
  created_at  TIMESTAMPTZ NOT NULL DEFAULT now()
);

CREATE TABLE order_items (
  order_id         BIGINT NOT NULL REFERENCES orders(order_id),
  product_id       BIGINT NOT NULL REFERENCES products(product_id),
  quantity         INT NOT NULL CHECK (quantity > 0),
  unit_price_cents INT NOT NULL,
  PRIMARY KEY (order_id, product_id)
);

CREATE INDEX idx_orders_customer_created
  ON orders (customer_id, created_at DESC);

Notice what you can explain from this schema:

  • Money is stored as integer cents, not a floating-point number, to avoid rounding errors.

  • unit_price_cents is copied onto order_items. The product price may change later, but a past order must keep what the customer actually paid.

  • CHECK (stock >= 0) is the safety net that makes overselling impossible at the database level.

  • The composite primary key on order_items stops the same product appearing twice in one order.

  • The index matches the “recent orders” query, filter first (customer_id), then the sort (created_at DESC).

The 6 Questions You Will Be Asked

1. “Why did you normalize this table?”

Weak answer: “Because that’s correct.”

Strong answer: “Without normalization, the customer’s name and email would be copied onto every order. If the email changes, I would have to update many rows, and missing one leaves the data inconsistent. Splitting customers into their own table removes that redundancy and those update anomalies. The cost is an extra join when I show an order with the customer’s details. If a read-heavy report made that join too expensive, I would denormalize that one path deliberately and explain how the copy is kept in sync.”

2. “This table is going to get huge. Then what?”

Weak answer: “We can shard it.”

Strong answer: “I would go in stages, from cheapest to most complex. First, indexes that match the real queries, such as (customer_id, created_at DESC), remembering they slow writes and use storage. Second, partitioning orders by time range, so recent queries touch fewer partitions and old data can be archived cheaply. You can practise this kind of scaling decision in the ScaleDojo Database Lab. Third, only if a single machine cannot handle the load, sharding by a key such as customer_id, because most queries are per customer. The trade-off is that cross-shard queries and transactions get harder.”

3. “Why relational, not a document store?”

Weak answer: “SQL is more reliable.”

Strong answer: “It depends on the data and the queries. Orders, payments and stock are structured, related and need transactions and constraints, so a relational database fits. A product catalog with very different attributes per product, read as a whole document, could fit a document store well. I would start with relational for the core and use a document or search store for the catalog if the flexibility is needed. SQL vs NoSQL is a decision about access patterns, not a preference.”

4. “Two users update this row at the same time. Then what?”

Weak answer: “The database handles it.”

Strong answer: Name the problem first: a lost update, where two users read the same stock, both subtract one, and one change disappears. Then give options:

-- Best here: one atomic conditional update (no race)
UPDATE products
SET stock = stock - 1
WHERE product_id = 42 AND stock > 0;
-- 0 rows updated means out of stock.

-- Pessimistic locking: block other writers
BEGIN;
SELECT stock FROM products WHERE product_id = 42 FOR UPDATE;
UPDATE products SET stock = stock - 1 WHERE product_id = 42;
COMMIT;

-- Optimistic concurrency: reject if the row changed
UPDATE products
SET stock = stock - 1, version = version + 1
WHERE product_id = 42 AND version = 7;

Then the trade-off: pessimistic locking is safer when conflicts are common but reduces throughput; optimistic concurrency scales better when conflicts are rare but needs retry logic. Mention that isolation levels define what concurrent transactions can see. For related system design concepts, see the ScaleDojo wiki.

5. “Why this index? What does it cost?”

Weak answer: “To make queries faster.”

Strong answer: “This index serves the ‘recent orders for a customer’ query. It filters by customer_id and returns rows already sorted by created_at, so the database avoids a separate sort. The cost is extra storage and slower inserts and updates, which is why I do not index columns I never filter on.” You can practise choosing and defending indexes like this in the Database Lab.

6. “The business now wants multiple currencies. What changes?”

Weak answer: “Add a column and update everything.”

Strong answer: “I would avoid a risky one-shot rewrite. I would add a currency column with a default, write the new field for new orders, backfill existing rows in batches, switch reads to use it, and only then remove old assumptions. I would also make sure prices and totals are always stored with their currency, and add monitoring so I can roll back safely.”

Common Schema Mistakes (and Fixes)

Mistake

Why it hurts

Fix

No primary key

Rows cannot be uniquely identified, foreign keys cannot point to the table

Add a primary key

Copying customer data onto every order

Update anomalies and inconsistent data

Store customer_id as a foreign key

A comma-separated list in one column

Breaks filtering and joins

Use a child table, like order_items

Money as FLOAT

Rounding errors

Use DECIMAL or integer cents

Dates stored as text

Unreliable sorting and no validation

Use TIMESTAMP or TIMESTAMPTZ

Indexing every column

Slower writes and wasted storage

Index only for named queries

Score Yourself After Each Practice Round

Rate yourself from 0 (missing) to 2 (defended with a reason) on six things: requirements, access patterns, schema clarity, data integrity, performance, and handling change. If you drew a nice schema but cannot name your top three queries, redo the round. If every read is fast but concurrent writes can break a rule, fix correctness first.

Practice Prompts

Try these, and change one requirement halfway through (a new sort order, soft deletion, or a write spike):

  1. A library system with members, books, copies and loans.

  2. A ride-sharing app with riders, drivers, trips and payments.

  3. A chat app with conversations, messages and unread counts.

  4. A URL shortener with links, users and click analytics.

  5. A booking system where the same slot must never be sold twice.

The fastest way to improve is to build the schema and defend it, not just read about it. ScaleDojo’s Database Lab has progressive schema design missions on an interactive ER canvas, so you can practise exactly this round and get feedback.

Frequently Asked Questions

How do I prepare for a database schema design interview? Learn the 6-step framework, practise two or three schemas end to end, and rehearse the six questions above out loud. Practising aloud matters, because the round is graded on how well you justify your choices.

What are the most common database design interview questions? Why you normalized or denormalized, how you would scale a huge table, relational vs document stores, how you handle concurrent updates, and why you chose each index.

Do I need to know every normal form? Know why duplication causes update anomalies and how to split tables to remove it. Applying normalization to the prompt matters more than reciting definitions.

How should I answer “SQL or NoSQL?” Start from the access patterns and consistency needs, then choose, and say what you give up. Avoid answering with a preference.

How much SQL should I write in the interview? Enough to make keys, constraints, one or two indexes and the hardest query concrete. Do not polish syntax unless the interviewer asks.

Where can I practise ER diagram problems online? The ScaleDojo Database Lab lets you build ER diagrams and schemas on an interactive canvas, starting with free missions.

Final Thoughts

A strong schema answer starts from the workload, protects the data with constraints, ties every index to a query, and explains the trade-offs clearly. Practise the six questions until your answers sound natural, then test yourself on new prompts.

Ready to practice? Open the Database Lab or explore all the hands-on labs at scaledojo.dev.

Enjoyed this article?

Share it with your network to help others level up their system design skills.

Discussion0

Join the Discussion

Sign in to leave comments, reply to others, or like insights.

Sign In to ScaleDojo

No comments yet. Be the first to start the thread!

Enjoyed this? Get more like it.

New levels, features, and one concept worth knowing - straight to your inbox.

No spam, ever. Unsubscribe in one click.

Enjoyed this content?

Your support keeps us creating free resources

We put a lot of hours into researching and writing these guides. If it helped you, consider buying us a coffee. Every bit goes toward keeping ScaleDojo's content free and growing.

$

One-time payment via Stripe. ScaleDojo account required.