Your query runs, the numbers look plausible, and the interviewer asks one quiet question: why is revenue higher than finance's total? In a mid-level Data Engineer SQL joins interview, correct syntax is the easy part. The points go to the candidate who defends the grain of the result before anyone has to find the bug.
This is a simulated mock interview built on one AI interview blueprint, with illustrative mistakes and coaching. It is not a transcript of a real person or a real company's questions.
Key Findings
- The interview is scored out of 100 points across 4 dimensions; Technical Proficiency is only 20 of them.
- Interviewer Objectives Alignment and Level-Specific Expectations are worth 30 points each, 60 of 100 combined.
- The conversation runs 30 minutes in 3 phases: framing (minutes 0 to 6), core query design (6 to 20) and validation (20 to 30).
- Core query design gets the longest slot at 14 minutes, and its checklist has 6 items.
- The scenario joins 5 tables, and 2 of them (shipments and order items) are one-to-many against orders.
- The validation phase gets 10 minutes, a third of the interview, and 5 checklist items.
- The interviewer has 6 prepared follow-ups; this walkthrough dramatizes 4 of them.
The Overlap Hides in the Setup
Two order systems are live during a migration, so the same order can sit in both. Before any join, the question is already a trap.
The interview question
You are supporting a commerce analytics team that wants a daily dataset of fulfilled orders for a marketplace with two order systems during an ongoing migration. The same real-world order may appear in both order tables. Some orders never ship, and some have multiple shipments. Some customer records are missing. Analytics defines a fulfilled order as one with at least one non-null delivered_ts.
legacy_orders (order_id, customer_id, order_ts, status, country_code, total_amount) new_orders (order_id, customer_id, order_ts, status, country_code, total_amount) shipments (shipment_id, order_id, shipped_ts, delivered_ts, carrier) order_items (order_id, sku_id, quantity, item_price) customers (customer_id, signup_date, segment)
Using the tables above, how would you build a SQL query for a daily dataset of fulfilled orders for the last 30 days, with one row per order and enough fields to report order date, delivered date, customer segment, country, item count, and order revenue?
The interviewer is probing whether you can translate a business request into correct SQL, pick join types and set operators on purpose, avoid duplicate counting, and validate with edge cases such as missing dimensions and conflicting data across systems. A mid-level bar means a mostly correct end-to-end shape with stated assumptions, even if the syntax is imperfect.
Four Follow-Ups, Four Places Points Leak
Each turn below shows a common answer, then the stronger move. Marcus is a composite candidate used only for illustration.
Turn 1: Two systems, one order
Interviewer: "If the same order can exist in both order systems, how would you combine those sources without double-counting orders?"
Turn 2: Shipments multiply rows
Interviewer: "Shipments is one-to-many with orders. How would you prevent row multiplication while still deriving a delivered date?"
Turn 3: Audit the migration
Interviewer: "Suppose finance wants to identify orders present in legacy_orders but not in new_orders during the migration window. How would you approach that with a set operation?"
Turn 4: Prove it is right
Interviewer: "How would you validate that your final query really returns one row per fulfilled order and not inflated revenue or item counts?"
Why Isn't Spotting These Mistakes Enough?
You probably saw every one of those coming. That is the trap: on the page you have unlimited time and one question at a time. Live, you have a few seconds, a half-written query, and an interviewer who changes direction mid-sentence. Reading about fan-out does not train you to say "let me check the grain" before you type the join.
The skill is retrieval under pressure, and it only comes from reps. A live mock interview gives you the follow-ups you cannot predict and scores you against the rubric, so the gaps show up before the real one does.
What Does a Strong Data Engineer SQL Joins Interview Look Like?
This is the blueprint a strong candidate hits, and it is exactly what the AI mock interview tracks you against in real time. The three phases split the 30 minutes into 6, 14 and 10.

- ✓States target grain explicitly as one row per fulfilled order
- ✓Recognizes two order sources may overlap and require deduplication
- ✓Recognizes shipments and order_items are one-to-many relative to orders
- ✓Notes missing customer rows should not necessarily exclude valid fulfilled orders
- ✓Combines legacy_orders and new_orders in a way that addresses overlap, such as UNION ALL followed by deduplication or UNION when justified
- ✓Filters to last 30 days using order date or clearly states an assumption if using delivered date
- ✓Builds a shipment-level aggregation to get one delivered date per order and uses it to define fulfilled orders
- ✓Builds an order_items aggregation to compute item count and optionally revenue if not trusting header totals
- ✓Uses LEFT JOIN to customers so missing customer dimension records do not drop fulfilled orders
- ✓Produces a final result with one row per order and the requested fields
- ✓Explains how to check for duplicate order_id in the final output
- ✓Describes how to reconcile order counts before and after joins to detect fan-out
- ✓Can articulate a concrete use of EXCEPT or INTERSECT for migration auditing or consistency checks
- ✓Discusses implications of UNION vs UNION ALL on correctness and performance
- ✓Calls out assumptions around delivered date selection when multiple deliveries exist

Notice how much of the card is judgment, not syntax: stating the grain, naming assumptions, and checking your own output. Those are the 60 points under Interviewer Objectives Alignment and Level-Specific Expectations.
Run This Join Scenario Live
Take this exact scenario into a timed session. Start the AI mock interview for a mid-level Data Engineer on SQL joins and set operations and answer the same opening question, then see how you handle follow-ups you have not read yet. It tracks you against the blueprint above while you talk.
Want a warmer-up first? Drill single questions in the joins and set operations question bank, or browse the Data Engineer preparation guides for the wider topic map.
FAQ
Q. What does a Data Engineer SQL joins interview test?
It tests whether you can turn a business request into a query with a clear grain, then protect that grain. In our 30-minute blueprint, the big risks are double-counted orders across two source systems, row multiplication from one-to-many tables, and dropped rows from the wrong join type. Technical Proficiency is only 20 of 100 points; Interviewer Objectives Alignment and Level-Specific Expectations are worth 30 each.
Q. When should I use UNION versus UNION ALL?
UNION ALL keeps every row and skips the sort or hash step that removes duplicates, so it is cheaper. UNION removes exact duplicate rows, which only works if the duplicated rows are identical in every column. When the same order can differ between systems (a status, a timestamp), dedupe explicitly on order_id with a stated rule for which copy wins.
Q. How do I avoid row multiplication when joining shipments to orders?
Aggregate the many side first, to one row per order, then join that result. For a delivered date, a common choice is MIN or MAX of delivered_ts per order_id, and you should say which one you chose and why. The blueprint checks that you call out this assumption when multiple deliveries exist.
Q. Should the customers join be INNER or LEFT?
LEFT, when the goal is every fulfilled order. The scenario notes that some customer records are missing, and an INNER JOIN would silently drop valid orders. The blueprint lists this as an explicit check in the core query design phase.
Q. How do EXCEPT and INTERSECT help during a migration?
EXCEPT finds order_ids present in the legacy system but missing from the new one, which is the core of a migration audit. INTERSECT shows the overlap, which tells you how many orders are at risk of double-counting. Both compare whole rows, so select just the key (or a deliberate column list) first.
Q. How do I prove my query returns one row per order?
Compare the row count to a count of distinct order_id in the output, and reconcile order counts before and after each join to catch fan-out. Then compare revenue and item totals against the source tables. The blueprint spends its final 10 minutes (minutes 20 to 30) on exactly this kind of validation.
Q. How do I practice this kind of interview?
Run it live. The AI mock interview for this role, level and topic asks unscripted follow-ups and tracks you against the same three-phase blueprint in real time. The question bank is a good warm-up for individual join and set-operation questions first.
Your Next Rep Is the Grain
Before the next join you write, say the grain of the result out loud and check it again at the end. That one habit covers most of what this interview rewards.
Topics
Ready to practice?
Put what you've learned into practice with AI mock interviews and structured preparation guides.