Normalization
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 4 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Build-up · 5 steps

    From one flat table to five

    The food-delivery start-up’s order-lines export, normalized one dependency at a time.

    Step 1 of 5

    The flat table

    One row per dish per order, keyed by order_id and dish_id, eleven columns. The rules come from the business. An order has one customer and one restaurant; a dish is on one menu.

    4 interview moments

    You’re the candidate

    The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

    1. Deep dive 1 of 4

      Interviewer

      “An engineer wants each order’s items in one jsonb list on the orders row, edited line by line. Do you agree?”

      Your move. Pick an approach:

    2. Deep dive 2 of 4

      Interviewer

      “In area_routing(area, cuisine, kitchen_id), each kitchen cooks one cuisine, so “K3 cooks North Indian” repeats. What do you do?”

      Your move. Pick an approach:

    3. Deep dive 3 of 4

      Interviewer

      “Search filters restaurants by cuisine tag and PIN code. Someone proposes restaurant_tags_pins(restaurant_id, tag, pin). Your call?”

      Your move. Pick an approach:

    4. Deep dive 4 of 4

      Interviewer

      “Your OLTP schema is in BCNF, and the order page joins five tables. A teammate wants restaurant_name copied onto every order. Your answer?”

      Your move. Pick an approach: