Skip to the page

Schema design · Concept

Normalise this orders table

The interviewer asks

What is normalization? Take this table and normalise it to third normal form: orders(order_id, customer_name, customer_phone, customer_city, product_ids, product_names, total).

Then

Follow-ups the interviewer asks next

  1. What problems does the original table have?
  2. Explain 2NF and 3NF in one line each, using this example.
  3. Should order_items store the product's price, or always read it from products?
  4. Is storing total on orders a violation? Would you keep it?
  5. What is BCNF, briefly?

The answer

What a strong answer covers

  • Problems: a comma-separated list of products (not atomic), the customer's phone repeated on every order (update anomaly), no way to store a customer without an order (insert anomaly).
  • 1NF: one value per cell, so products move to order_items rows. 2NF: nothing depends on only part of a composite key (product_name depends on product_id alone, so it moves to products). 3NF: no non-key column depends on another non-key column (customer_city depends on the customer, so it moves to customers).
  • Result: customers, products, orders(customer_id, …), order_items(order_id, product_id, qty, unit_price).
  • unit_price on order_items is the price at the time of purchase, a different fact from today's price, so it belongs there.
  • total is derived; keeping it is a deliberate denormalisation for speed and audit, and must match the items.
  • BCNF: every determinant is a candidate key; it differs from 3NF only in unusual overlapping-key cases.

The red pen

Common traps

Avoid:reciting definitions without applying them; removing unit_price from order items "because it's in products".

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview