Practise data engineer interview questions by taking one dataset from a SQL query through a production failure. Start by saying what one row means, then show what should happen if a record arrives late, a job retries, or a dashboard reports the wrong number. The 14 prompts below use the same orders example so you can hear whether your answers still agree when the interviewer changes the requirements.
Imagine a retailer that sends order updates from its checkout service. Finance wants an order count it can explain, and operations wants to know when the feed has stopped. The examples are fictional. Use paper or a whiteboard to sketch the input, the output, and where you’d put a check. You can answer the first few questions with the small sample below and reuse the same sketch for the design round.
What should you clarify before you write any SQL?
1. What does one row represent? In our raw feed, a row represents a status update to an order. The same order ID can appear many times. In the table for finance, a row represents one order in its latest known state. Ask what counts as a paid order, which timezone defines a business day, and whether refunds should revise earlier reports. For this exercise, count orders whose latest status is paid, group by the original order date in UTC, and assume the input already includes that date. In a real interview, write those assumptions where you can refer to them later.
Here’s the sample as of the reporting cutoff. A source version increases within each order. The source guarantees that two records with the same order ID and version represent the same update.
| Order ID | Order date (UTC) | Source version | Status | Arrival order |
|---|---|---|---|---|
| A1 | May 10 | 1 | paid | 1 |
| B2 | May 10 | 1 | paid | 2 |
| A1 | May 10 | 2 | cancelled | 3 |
| C3 | May 11 | 2 | paid | 4 |
| C3 | May 11 | 1 | pending | 5 |
| B2 | May 10 | 1 | paid | 6 |
2. How do you count paid orders by day? Rank all updates for an order by source version, keep the first, then filter to paid. Use arrival sequence to break ties among copies of the same version. The result is one paid order on May 10, B2, and one on May 11, C3. Filtering first would count A1, and sorting by arrival alone would lose C3. Days with no paid orders are absent from this result. If the report needs explicit zeroes, join the counts to a calendar and fill the missing values.
WITH ranked AS (
SELECT order_id, order_date, status,
ROW_NUMBER() OVER (
PARTITION BY order_id
ORDER BY source_version DESC, arrival_seq DESC
) AS rn
FROM order_updates
)
SELECT order_date, COUNT(*) AS paid_orders
FROM ranked
WHERE rn = 1 AND status = 'paid'
GROUP BY order_date
ORDER BY order_date
If you get asked for the count as of a past cutoff, restrict the input to updates available at that cutoff before ranking. Confirm whether “as of” refers to what the system knew at the time or what the source says had happened by then. With delayed events, those are different reports. This SQL interview practice guide has more window function and join prompts if you want a fresh dataset after this one.
How would you make an incremental load safe to rerun?
3. Which checkpoint would you store? Use a change-stream offset if the source offers an ordered log you can resume from. For a pull API, use a documented cursor or a bounded overlap on a reliable source change field, with a tie-breaker if the API supports one. A checkpoint based on the largest order date misses corrections to old orders. If the source can deliver changes outside your overlap, arrange a periodic reconciliation or another way to retrieve them. Tell the interviewer how you’ll find a missed change before finance finds it.
4. What happens if the worker crashes after writing the destination? Keep the input batch addressable and give writes a stable key. Stage the raw updates, merge the current-state rows by order ID, and allow a higher source version to replace a lower one. A replay of the same input leaves the same state. Advance the read checkpoint only after the destination change commits. If checkpointing and publication can’t share a transaction, assume the write may be replayed. Test the awkward case out loud. The destination has version 2 for A1, the worker crashes, and on restart it sees version 1 followed by version 2 again. A1 should still be cancelled and there should still be one current row.
5. What would you code in Python for a source file? Iterate through the file with an appropriate parser. Validate the required fields and status values, then report how many rows pass and how many are quarantined. Keep the original input reference and a reason for each rejection so another person can trace it. If the task asks you to retain the newest version per order, a dictionary keyed by order ID works when the number of distinct orders fits in memory. For a bigger input, stage the data and let the database or processing engine choose the newest version per ID. Check ties explicitly. Identical copies are safe to collapse. Conflicting statuses at the same version break the source contract and should be flagged for investigation.
A small paper test is enough to expose most mistakes in that answer. Draw a box around C3’s highest version, underline the later-arriving pending row, and make yourself say why it loses. Add one invalid row and one repeat of B2, then state which records go to the current table, which stay in the raw input, and what you’d count in the quarantine report. This gives you concrete tests to explain before you start writing code.

How would you model orders for two teams?
6. Would you keep both history and current state? Keep an append-only history at the order-update grain and build a current-state table keyed by order ID. The history supports questions about transitions and what changed. The current table supports questions about orders open now or paid at the latest cutoff. If finance must reproduce a number from last month’s close, agree on an as-of rule or preserve the report inputs for that close. Retain the minimum sensitive fields needed for each use and keep read permissions narrower on the raw layer.
7. How would you model revenue after a partial refund? First ask whether the report tracks payment events on the day they happen or restates revenue on the original order date. If an order has two items and three payment events, a direct join on order ID produces six rows and can multiply revenue. Aggregate payment events to the grain the report needs before you join, or use an allocation that finance has agreed to when totals must be split by item. Test with a single order containing multiple items and a partial refund. Check the result against the ledger total and say which date your result uses. You can explain this on a whiteboard by drawing separate boxes for orders, items, and payments and writing the key inside each box.
How would you design the pipeline if freshness requirements changed?
8. Where would you use ETL or ELT? Choose where to transform based on data access rules, the processing you need, and where you can enforce them. With ELT, you land permitted source data in the destination and transform it there. With ETL, you do some or all transformations before loading to that destination. If raw events contain fields that the analytics warehouse may never hold, drop or redact those fields at an earlier boundary. A reasonable first design for hourly reporting is a restricted raw landing area, a validated orders table, and a reporting model that changes only after its checks pass. An orchestrator schedules the work and records dependencies, failures, and retries so you know which step to rerun.
9. What changes if operations needs updates within a minute? Ask which signal needs that freshness. A stopped checkout feed may need a fast alert while hourly finance totals remain acceptable. For continuously updated order counts, consider a streaming consumer and define event time, arrival time, and what happens when a late record misses the window’s allowed delay. In a stateful stream, a watermark helps the engine decide how long to retain state for event-time windows. Decide separately whether very late updates should flow through a reconciliation job, require a correction to a published number, or be reported as exceptions. For the minute target, measure the time from a source commit to a visible update. A fast consumer may still be publishing behind a slow source or destination. You can rehearse these trade-offs with the system design interview prep guide.
10. How would you diagnose a slow Spark join? Open the query plan and compare stage metrics with a healthy run. If most tasks finish quickly and one or two handle far more data or spill to disk, check whether a few keys dominate the shuffle. In the orders example, a default customer ID could be the hot key. Work out whether those rows should participate in the join before changing the execution plan. If the smaller input actually fits in worker memory, a broadcast join may remove a shuffle. If the data is valid but uneven, look at adaptive skew handling or split the hot key into a separate path. Compare that with a case where all tasks are slow and scan volume rose. There, you’d investigate layout, filters, or input growth first. After tuning, compare the output and check runtime and resource use. Apache Spark’s performance tuning documentation

A common follow-up is whether you’d partition files by order ID. Think through the reads before answering. If reports filter by date and most order IDs occur once, storing paths by ID could create large numbers of tiny files. Date partitioning may make sense for those reads if the partitions remain reasonably sized. How you lay out files for a query is separate from how Spark distributes rows during a particular join. Say which one you’re changing and what measurement would tell you it worked.
What do you say when finance reports a wrong number?
11. Which checks would tell you where the problem started? Begin with the last successful publish, compare the source counts at the same cutoff, then trace one affected order through landing, transformation, and the reporting layer. Track source lag and the age of the newest expected data. Validate uniqueness at the current-table grain, required values, rejected records, and reconciliation totals at the date or batch level. A retry can leave the raw feed larger than expected while the reporting table is still correct. If your checks compare raw row counts directly with current rows, they’ll warn on routine retries and miss more useful signals.
12. How would you backfill without making things worse? Identify the affected order dates, the source versions involved, and which dashboards or exports depend on the table. Replay the smallest affected slice into staging using the preserved input. Compare keys and totals at the report grain, including unpaid and cancelled orders. Confirm unaffected slices still match and review the diff with finance before publishing. If live writes can overlap the backfill, use a shared version rule for current-state merges or coordinate an atomic change to the affected report partition. Check what happens to a late arrival during the rebuild. Announce the affected window, temporary source of truth, and time of the next update while the repair is underway.
13. Tell me about a data incident you handled. Pick a real story where you can separate your actions from the team’s. Explain who relied on the output, how you found the bad rows, and what you did to keep the problem from spreading. If you’ve only worked on a class project, describe the dataset or report that broke and how you reproduced the fault. Use a number only if you can explain where it came from. “I traced the missing records to a date filter and wrote a regression test with a late file” is enough if that’s what happened. When you’re ready for the behavioral round, practise the ownership and learning parts with this guide to discussing a mistake in an interview.
How can you practise the follow-ups in one sitting?
14. What do you do when the interviewer changes the prompt? Restate what changed and point to the part of the solution it affects. Try this follow-up with a partner. After you finish the SQL query, they hand you an additional slip of paper with “A1, May 10, version 3, paid”. May 10 should now have two paid orders if the report uses current state. A report frozen at the original cutoff still has one. Ask the partner to slide the new slip across a table after you’ve written down the first answer. That small interruption is a good test of whether you’ll revisit a decision you just defended.

Give yourself 30 minutes for a mock. Use the first eight for the SQL prompt and two expected results. Allow ten minutes to draw the source, checkpoint, reporting model, and data quality checks. Take eight minutes to explain the failed run and safe replay, and spend the final four on feedback. If you’re alone, write down your expected output before you add the update, then say what changes and which checks you’d rerun. Save the rough paper so you can see the first assumption you missed.
Grade the mock on evidence you can hear or see. Did you give the original correct two-row result? Did the replay keep A1 cancelled until version 3 arrived? Did you explain how finance could reproduce the earlier report after current state changed? Did you say who would confirm the fix and what they would check? If an answer failed on grain, spend your next session explaining one row in each table and testing the effect of a join. If you missed the replay behavior, draw the two writes and the checkpoint in order, then have someone stop you between them.
If you want to hear how your incident explanation holds up in conversation, use Hiintly during a practice call with a friend and check whether the answer stays in your own words when they interrupt. The free session lasts 10 minutes and resets after a five-minute cooldown. On the second pass, have your partner ask what you would measure before choosing the fix. You can use a different dataset on the next round once you can make that choice and explain it from the evidence.
Frequently Asked Questions
- How much SQL should I prepare for a data engineer interview?
- Be comfortable with joins, aggregates, window functions, deduplication, and explaining the result grain before you write. Practise on small inputs where you can check the result by hand, including null keys and duplicate events.
- How should I prepare if I have never worked with Spark?
- Practise reading a query plan and explaining how partition size, shuffles, and uneven keys affect a distributed job. Use a small example you can reason through and say which parts you have tried yourself.
- What is the difference between a load checkpoint and a watermark?
- A load checkpoint tracks how far the reader has processed the source so it can resume. An event-time watermark is used to manage state and late data in a streaming computation. They answer different questions and can coexist in the same pipeline.
- Do junior data engineer interviews include system design?
- The format varies. Ask what the round covers and be ready to explain a small pipeline from input to output, including a basic quality check and what happens if a run fails.
- How should I answer when I do not know a tool the interviewer names?
- Say what you have used and connect it to the underlying problem. Ask for the relevant constraint, then explain the decision you would make and what you would measure to confirm it.
- How can I practise a data engineering incident without production experience?
- Take a small project and introduce one failure, such as a duplicate input or a delayed update. Record the wrong result, fix the cause, replay the same input, and show that the results agree with what you expected.

aa.png)


