Data Engineer Interview Questions & Answers
40 questions for Data Engineer interviews — 1 easy, 36 medium, 3 hard.
About the Data Engineer role
A Data Engineer builds pipelines that move data from source systems into warehouses and lakes, using SQL heavily for transformations along with Python and orchestration tools. They design star schemas, handle incremental loads and slowly changing dimensions, and tune queries on platforms like Snowflake, BigQuery or Databricks. Advanced SQL is tested in every data engineering interview.
An interviewer asks how you would find why a query is slow. What steps do you describe?
Show answer
What are referential actions such as ON DELETE CASCADE?
Show answer
Tell me about a time you used advanced SQL to solve a business problem.
Show answer
Someone ran an UPDATE without WHERE on production. What would you do?
Show answer
Tell me about a database design decision you made and its outcome.
Show answer
Tell me about a time you significantly improved query performance.
Show answer
Your running total jumps by large amounts on some dates instead of row by row. Why?
Show answer
What is a trigger and when should it be used?
Show answer
A query that ran in 1 second now takes 40 seconds after a data load. What do you check?
Show answer
Describe a time you reviewed someone else's SQL and suggested improvements.
Show answer
A query with a correlated subquery in SELECT runs for every row and is slow. How do you improve it?
Show answer
Why is NOT IN dangerous when the subquery contains NULL?
Show answer
You need each customer's latest address from a history table. How do you query it?
Show answer
What are window functions in SQL?
Show answer
What is a window frame and what is the default frame?
Show answer
What are surrogate keys and natural keys?
Show answer
What is a SARGable query and why does it matter?
Show answer
A table stores phone numbers as 'ph1, ph2, ph3' in one column. What is wrong and how do you fix it?
Show answer
Can you use window functions with aggregate functions in the same query?
Show answer
What is a star schema and a snowflake schema?
Show answer
Rewrite a nested query using CTEs for readability.
Show answer
What is denormalisation and when is it used?
Show answer
You need to delete duplicate rows but keep one copy of each. How do you do it?
Show answer
What is the difference between an index scan and an index seek?
Show answer
Are CTEs materialised or inlined?
Show answer
What is a covering index?
Show answer
What are LAG and LEAD functions?
Show answer
Calculate a 7-day moving average of daily active users.
Show answer
A query with many OR conditions across different columns is slow. How can you optimise it?
Show answer
How would you design a database for an online food delivery app at a high level?
Show answer
An interviewer asks for the Nth highest salary in a reusable way. How do you answer?
Show answer
What are FIRST_VALUE, LAST_VALUE and NTH_VALUE?
Show answer
What is the difference between IN and EXISTS?
Show answer
How do you read an EXPLAIN ANALYZE output in PostgreSQL?
Show answer
What are database statistics and why do they matter?
Show answer
What is the difference between ROWS and RANGE frames?
Show answer
Write a recursive CTE to show an employee hierarchy with levels.
Show answer
Write an upsert that inserts a row or updates it if it exists.
Show answer
The dashboard queries hit the production database and slow down the app at month end. What do you propose?
Show answer
Frequently asked questions
What does a Data Engineer do?
A Data Engineer builds pipelines that move data from source systems into warehouses and lakes, using SQL heavily for transformations along with Python and orchestration tools. They design star schemas, handle incremental loads and slowly changing dimensions, and tune queries on platforms like Snowflake, BigQuery or Databricks. Advanced SQL is tested in every data engineering interview.
Which skills are tested in a Data Engineer interview?
Expect questions on Advanced SQL, Data modelling, ETL and ELT, Python, Cloud warehouses. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a Data Engineer interview?
Revise Window Functions, Database Design, Indexes and Performance, Subqueries and CTEs first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.