Data engineer interview questions: four worked answers on SQL and pipelines, and how to prepare
Expect questions on SQL, on how data moves from a source to a table people can query, and on a project of yours. No public page we read lists what any company asks, so the topics below are our own reading of the work. Four worked answers use sample rows and are computed by code: keeping the latest row per key, finding customers with no orders, filtering groups, and loading a batch twice safely.
Your first hour with George Li (60 minutes by video, $250) ends with a written plan within one working day.
Book your first hour ($250)What happens at this stage
A data engineer builds and runs the pipelines that move data from where it is produced to where it is analyzed. A university career office describes technical interviews for data roles as asking you to analyze data, write SQL queries, explain metrics and talk through how you would clean and organize a dataset. Beyond that, each company has its own format, and the recruiter can tell you what to expect for your role. The topics here come from the work itself.
| Topic | What to be able to say | A check |
|---|---|---|
| SQL: joins, grouping and filtering groups | What each join keeps and drops, why a filter on grouped totals goes in HAVING and not WHERE | Answers 2 and 3 below |
| SQL: window functions | How a window keeps every row while it computes across related rows, and how row_number picks one row per key | Answer 1 below |
| Duplicates and late updates | Why a source sends several versions of one record and how you keep the latest | Answer 1 below |
| Loading safely | Why running a load twice must not double the data, and what key makes that true | Answer 4 below |
| Batch and the order of steps | The difference between transforming before loading and loading first, then transforming inside the warehouse | Read the AWS page in the sources |
| One of your projects | The input, the output, what broke and how you found out | Say it aloud in two minutes |
Four worked answers
The sample data is made up. An orders feed sends 8 rows for 5 orders, because a source sends a new row each time an order changes. There are 5 customers, A to E. Every result below is computed from those rows by code, and we also ran the same queries in SQLite to confirm they return the same rows.
Answer 1, keep the latest row per order. The PostgreSQL documentation says a window function computes across related rows without collapsing them, and that row_number numbers the rows inside each partition in the order you give. So number each order’s rows from newest to oldest and keep number one: row_number() over (partition by order_id order by updated_at desc), then filter to 1 in an outer query. The documentation warns that tied rows are numbered in an unspecified order, so add a second sort key if two rows can share a time.
Result: 5 rows remain, one per order: 1001 (shipped), 1002 (new), 1003 (cancelled), 1004 (new), 1005 (cancelled). Order 1001 shows shipped and not new, and order 1003 shows cancelled, because those were the later rows. The 3 older rows are dropped.
Answer 2, find customers with no live order. Start from the customer list, left join the latest orders that are not cancelled, and keep the customers where the joined order id is empty. A left join keeps every row on the left, and an empty match is how you find the customers who have none. Result: D and E. Customer D never ordered, and customer E’s only order was cancelled. An inner join would have hidden both.
Answer 3, find customers who spent at least 30. Group the live orders by customer and filter the groups with HAVING sum(amount) >= 30. WHERE filters rows before they are grouped, so it cannot see a total. Totals by customer: A 40, B 25, C 15. Only customer A passes. Customer A’s cancelled order for 60 is not counted, because the question asked for live orders.
Answer 4, load the same batch twice. If a job appends its rows and then runs again after a failure, the table holds 16 rows for the 8 that were sent. If the load is keyed on the order id and the update time, which together identify a version, the second run finds each key already present and the table still holds 8. That property is called idempotence in data engineering, and it is our reading of what a safe load needs, not a quotation from a source. The usual ways to get it are an upsert on a key, or deleting a partition and loading it again in one transaction.
One concept question to prepare. AWS describes ETL as transforming data before loading it and ELT as loading it directly into the destination and transforming it there, using the processing power of cloud data warehouses, and it calls ELT the standard choice for modern analytics while naming cases where ETL is still considered. Say what each costs and when you would pick the other, using one project of yours as the example.
How to prepare, week by week
This plan is ours. It fits four weeks and you can compress it. Each week produces something you can say aloud.
| Week | What you do | What you have at the end |
|---|---|---|
| 1 | Re-learn each join type and write one query for each on a small table you invent. Predict the row count before you run it | A list of five queries with predicted and actual row counts |
| 2 | Write the latest-row-per-key query three ways: a window function, a join to a grouped maximum and a sort with a limit. Note when each breaks, such as ties | Three queries and the case that breaks each |
| 3 | Build a small pipeline end to end on a laptop: read a file, clean it, load it twice and show the table is unchanged | A project you can explain in two minutes |
| 4 | Do a mock interview in which you explain a query aloud and then change a requirement. Write three questions to ask the team | A recorded or timed practice run |
A mock interview with someone who can ask follow ups is the step most students skip. The thinking out loud guide shows how to narrate a query as you write it. For data science roles, see the data science internship interview guide, and for general software roles see the software engineer interview prep course guide.
What to ask the interviewer
Ask what the data sources are and how often they arrive, how the team finds out when a pipeline fails, what a typical intern project is, who reviews your work and how, and what tools the team uses day to day. Each question shows that you think about running a pipeline, not just writing one query.
What comes next and typical timing
After the interview the employer decides, and timing varies by company and role. Ask near the end when you should expect to hear, and send a short note the next day; the guide to a thank you email after an interview shows how. If a posting lists a skill you have not used, such as a named tool, say what you have used that is close and how you would learn it.
Questions
What SQL questions are asked in a data engineer internship interview?
No public page we read lists what any company asks. A university career office says technical interviews for data roles may ask you to write SQL queries, explain metrics and talk through cleaning a dataset. The topics worth practicing are joins, grouping, window functions and keeping the latest row per key.
What is the difference between WHERE and HAVING?
WHERE filters rows before they are grouped, so it cannot see a total. HAVING filters the groups after they are formed, so it can keep customers whose summed amount is at least a number.
How do you remove duplicates and keep the latest record?
Number each key’s rows from newest to oldest with row_number() over (partition by key order by updated_at desc) and keep number one. The PostgreSQL documentation says tied rows are numbered in an unspecified order, so add a second sort key when ties are possible.
What is ETL versus ELT?
AWS describes ETL as transforming data before it is loaded and ELT as loading it into the destination first and transforming it there. It calls ELT the standard choice for modern analytics and lists cases where ETL is still considered.
How a session helps
A session with George is a place to talk through your plan and hear your reasoning questioned. You write every word and send every message yourself. An hour is $250, and a package of 5 sessions is $1,165. Your first purchase is refundable for unused time within 7 days. Bring a query you wrote and one project, and we will go through them aloud with follow up questions. See the interview prep guides, the college students page and the packages page.
Want help with your own applications? See internship interview coaching, a career coach for college internships, or resume review for internships.