Data engineer interviews test SQL first, then data modelling (star schema), ETL versus ELT, batch versus streaming, partitioning, Spark basics and orchestration. Expect to design a small pipeline on a whiteboard and defend choices such as idempotency and late data. These 38 questions give short answers, and the SQL examples were run on SQLite.
On this page
SQL, modelling and the warehouse (Q1 to Q12)ETL, ELT and pipeline design (Q13 to Q22)Spark basics (Q23 to Q32)Orchestration, tools and your project (Q33 to Q38)Frequently asked questionsFor students, analysts and developers moving into data engineering in India. The SQL below was run with Python's sqlite3 (SQLite 3.54.0 here) and the quoted results match. Spark defaults (200 shuffle partitions, a 10 MB broadcast threshold, adaptive query execution on by default) were read in the Spark SQL performance tuning page of the current documentation on 1 December 2026, and may change by version. PySpark was not installed locally, so the Spark snippet is proofread, not run.
Search Console export of 26 November 2026 has no direct row for these queries. In Google Trends India (research/trends/trends-summary.json) the interview group peaks in February at about 1.1 to 1.2 times its yearly average, so plan prep from December to March. No trend row exists for 'data engineer interview questions' itself. Read the data engineer roadmap, check pay in data engineer salary in India, practise on SQL interview questions and see the data analytics learning path.
SQL, modelling and the warehouse (Q1 to Q12)
Data engineering rounds start with SQL because everything downstream depends on it. The script below builds a tiny star schema (one fact table, two dimensions), runs a business query, loads a correction twice to show idempotency and keeps the latest record per key.
import sqlite3
con = sqlite3.connect(":memory:")
con.executescript("""
CREATE TABLE dim_customer (customer_key INTEGER PRIMARY KEY, customer_id TEXT, city TEXT);
CREATE TABLE dim_date (date_key INTEGER PRIMARY KEY, full_date TEXT, month TEXT);
CREATE TABLE fact_orders (order_id TEXT PRIMARY KEY, customer_key INTEGER, date_key INTEGER, amount INTEGER);
INSERT INTO dim_customer VALUES (1,'C1','Pune'), (2,'C2','Delhi'), (3,'C3','Pune');
INSERT INTO dim_date VALUES (20260105,'2026-01-05','2026-01'), (20260210,'2026-02-10','2026-02'), (20260214,'2026-02-14','2026-02');
INSERT INTO fact_orders VALUES ('O1',1,20260105,500), ('O2',2,20260210,800), ('O3',3,20260214,300), ('O4',1,20260214,200);
""")
# 1. Star schema query: one fact table joined to small dimensions
print(con.execute("""
SELECT c.city, d.month, SUM(f.amount) AS revenue
FROM fact_orders f
JOIN dim_customer c ON c.customer_key = f.customer_key
JOIN dim_date d ON d.date_key = f.date_key
GROUP BY c.city, d.month ORDER BY c.city, d.month""").fetchall())
# 2. Idempotent load: the same batch run twice must not double-count
batch = [("O3", 3, 20260214, 350), ("O5", 2, 20260214, 100)] # O3 corrected, O5 new
upsert = """INSERT INTO fact_orders VALUES (?,?,?,?)
ON CONFLICT(order_id) DO UPDATE SET amount = excluded.amount"""
for _ in range(2):
con.executemany(upsert, batch)
print(con.execute("SELECT COUNT(*), SUM(amount) FROM fact_orders").fetchone())
# 3. Deduplicate a raw landing table, keep the latest record per key
con.executescript("""
CREATE TABLE raw_events (event_id TEXT, payload TEXT, loaded_at TEXT);
INSERT INTO raw_events VALUES ('E1','old','2026-03-01'), ('E1','new','2026-03-02'), ('E2','only','2026-03-01');
""")
print(con.execute("""
SELECT event_id, payload FROM (
SELECT *, ROW_NUMBER() OVER (PARTITION BY event_id ORDER BY loaded_at DESC) AS rn FROM raw_events
) WHERE rn = 1 ORDER BY event_id""").fetchall())
Output:
[('Delhi', '2026-02', 800), ('Pune', '2026-01', 500), ('Pune', '2026-02', 500)]
(5, 1950)
[('E1', 'new'), ('E2', 'only')]The second line shows a batch of two rows (a corrected order and a new order) loaded twice with an upsert: 5 orders and 1,950 in total, not 7 orders and 2,100. That property is called idempotency, and interviewers ask about it in almost every pipeline design question.
| Aspect | OLTP database | Data warehouse (OLAP) |
|---|---|---|
| Purpose | Run the application: many small reads and writes | Analysis: large scans and aggregates |
| Schema | Normalised, many tables | Denormalised star or snowflake schema |
| Storage layout | Row-oriented | Usually column-oriented |
| History | Current state | Full history, often append-only |
| Example | PostgreSQL behind an app | BigQuery, Snowflake, Redshift |
- Q1. What is a star schema? A central fact table of events or measures (orders, amount) joined to small dimension tables (customer, date, product). It makes analytic queries simple and fast. The query above groups revenue by city and month with two joins.
- Q2. Star or snowflake schema? A snowflake normalises the dimensions into further tables, which saves a little storage and adds joins. Star is easier to query and usually preferred in warehouses. Kimball's dimensional modelling techniques describe the star pattern.
- Q3. What is the grain of a fact table, and why decide it first? The grain says what one row means, such as one order line. Every measure and dimension must match it. Mixing grains causes double counting.
- Q4. What are fact and dimension tables? Facts hold numeric measurements of events and are large and narrow. Dimensions hold descriptive attributes used to filter and group and are small and wide. Facts carry foreign keys to dimensions.
- Q5. What are slowly changing dimensions? A way to handle a dimension attribute that changes, such as a customer's city. Type 1 overwrites and loses history. Type 2 adds a new row with validity dates and keeps history. Type 3 keeps the previous value in a column.
- Q6. What is a surrogate key and why use one? A meaningless integer key generated by the warehouse. It isolates the warehouse from source-system key changes and makes Type 2 history possible, because one business key can have several rows.
- Q7. How do you deduplicate rows in SQL? Number the rows per key with
ROW_NUMBER() OVER (PARTITION BY key ORDER BY loaded_at DESC)and keep row 1. The last query kept the newestE1record ('new') and the singleE2. - Q8. OLTP or OLAP, and row or column storage? OLTP serves transactions. OLAP serves analysis. Columnar storage reads only the columns a query needs and compresses well, which suits scans. See the table above.
- Q9. Normalisation versus denormalisation? Normalisation removes redundancy for safe writes. Denormalisation duplicates data to cut joins for fast reads. Operational stores lean normalised and warehouses lean denormalised.
- Q10. What is a data lake, and what is a lakehouse? A lake stores raw files cheaply in object storage in any format. A warehouse stores modelled tables. A lakehouse adds table formats, transactions and SQL over lake storage so one copy serves both.
- Q11. What does ACID mean, and do warehouses have it? Atomicity, consistency, isolation and durability for transactions. Many modern warehouses and table formats give transactional guarantees for writes. Check the product's documentation instead of assuming.
- Q12. How do you speed up a slow SQL query? Read the query plan, filter early, select only needed columns, avoid functions on indexed columns, use the right join order and index, and pre-aggregate large tables. Partition pruning (Q22) helps in warehouses.
ETL, ELT and pipeline design (Q13 to Q22)
- Q13. ETL or ELT? ETL transforms data before loading it, on a separate engine. ELT loads raw data into the warehouse first and transforms it there with SQL. Cheap warehouse compute made ELT common, and ETL still fits when data must be cleaned or masked before landing.
- Q14. What is an idempotent pipeline, and how do you make one? Running it twice gives the same result as running it once. Use upserts or merge on a key, overwrite the partition you are loading instead of appending, and avoid job logic that depends on the clock. The upsert above kept 5 rows after two loads.
- Q15. Full load or incremental load? A full load reloads everything and is simple but costly. An incremental load takes only new or changed rows using a timestamp, an ID or change data capture (CDC). Run a periodic full reconciliation to catch missed deletes.
- Q16. What is CDC? Change data capture reads inserts, updates and deletes from a database's log or tables and ships them downstream. It catches deletes and avoids heavy polling queries.
- Q17. How do you handle late-arriving data? Choose the event time over the arrival time, reprocess a lookback window (for example the last three days), and make loads idempotent so reruns are safe. Streaming systems use watermarks to decide how long to wait.
- Q18. How do you validate data quality? Check row counts against the source, null and uniqueness rules on keys, ranges and referential integrity, freshness, and distribution drift. Fail or quarantine bad batches, and alert on them.
- Q19. What is a staging layer or the medallion pattern? Raw data lands untouched (bronze), is cleaned and conformed (silver), then modelled for use (gold). Keeping raw data lets you reprocess when logic changes.
- Q20. Batch or streaming? Batch processes data in scheduled chunks, which is simpler and cheaper and fits daily reports. Streaming processes events continuously for seconds-level latency, such as fraud detection, at higher operational cost. Ask what latency the business needs before choosing streaming.
- Q21. Explain Kafka at a basic level. Kafka is a distributed log. Producers write events to topics split into partitions, consumers read at their own offsets in consumer groups, and events are retained for a set time, so consumers can replay them.
- Q22. What is partitioning in storage, and why? Splitting a dataset into folders or segments by a column, usually date, so queries read only the partitions they need. The demo below stores three date partitions and scans 2 of 5 rows for one date.
# Partition pruning idea in plain Python: files grouped by date, a query reads only the dates it needs
from collections import defaultdict
rows = [("2026-03-01", 100), ("2026-03-01", 50), ("2026-03-02", 70), ("2026-03-03", 30), ("2026-03-03", 10)]
partitions = defaultdict(list)
for day, amount in rows:
partitions[day].append(amount) # like folders dt=2026-03-01/
wanted = ["2026-03-03"]
read = {d: partitions[d] for d in wanted}
print("partitions stored:", len(partitions), "| read:", len(read), "| rows scanned:", sum(len(v) for v in read.values()), "of", len(rows))
print("sum:", sum(sum(v) for v in read.values()))
partitions stored: 3 | read: 1 | rows scanned: 2 of 5
sum: 40Choose a partition column with moderate cardinality that appears in filters. Partitioning by user ID creates millions of tiny files, which slows listing and reading.
Spark basics (Q23 to Q32)
Know the execution model. Transformations are lazy, an action triggers a job, and a wide transformation causes a shuffle. This PySpark job reads Parquet, aggregates and writes partitioned output. It was proofread and not run.
from pyspark.sql import SparkSession, functions as F
spark = SparkSession.builder.appName("daily_revenue").getOrCreate()
orders = spark.read.parquet("s3://bucket/orders/") # lazy: nothing runs yet
daily = (orders.filter(F.col("status") == "PAID")
.groupBy("order_date")
.agg(F.sum("amount").alias("revenue"))) # wide transformation: shuffle
daily.write.mode("overwrite").partitionBy("order_date").parquet("s3://bucket/daily_revenue/") # action: job runs| Operation | Type | Shuffle? |
|---|---|---|
filter, select, map | Narrow transformation | No |
groupBy then agg, join, distinct, repartition | Wide transformation | Yes |
coalesce | Narrow (reduces partitions) | No |
count, collect, write, show | Action | Triggers the job |
- Q23. What is Spark, and why use it? A distributed engine that processes data in memory across a cluster, with APIs in Python, Scala, Java, R and SQL. Use it when data no longer fits one machine or needs parallel processing.
- Q24. RDD, DataFrame or Dataset? RDDs are the low-level distributed collections. DataFrames add named columns and a query optimiser (Catalyst), and are the default choice. Datasets add compile-time types in Scala and Java.
- Q25. What is lazy evaluation? Transformations only build a plan. Work starts when an action runs. This lets Spark optimise the whole plan, for example pushing filters before a join.
- Q26. What is a shuffle, and why is it expensive? Moving data across the network to regroup it by key for joins and aggregations. It involves disk and network I/O. Reduce it by filtering early, using broadcast joins and avoiding unnecessary wide operations.
- Q27.
repartitionorcoalesce?repartitioncan increase or decrease partitions with a full shuffle and evens out sizes.coalesceonly reduces partitions and avoids a full shuffle, so it is cheaper but can leave uneven partitions. - Q28. What is a broadcast join? Spark sends the small table to every executor so the large table is not shuffled. The default
spark.sql.autoBroadcastJoinThresholdis 10 MB in the current documentation, read on 1 December 2026. - Q29. What is data skew, and how do you fix it? One key holds far more rows than others, so one task runs long. Check the Spark UI for a straggler. Fix it with adaptive query execution (on by default in current Spark), salting keys, filtering the hot key or broadcasting.
- Q30. What does
spark.sql.shuffle.partitionsdo? It sets the number of partitions after a shuffle, 200 by default in the current docs. Too few makes large tasks and memory pressure, too many makes tiny tasks. Adaptive execution can coalesce them. - Q31. When do you cache a DataFrame? When you reuse it several times in one job and recomputing is costly. Caching uses memory, so unpersist when finished. Caching something used once only wastes memory.
- Q32. What is the file format choice: CSV, JSON, Parquet or ORC? CSV and JSON are row-based text and slow for analytics with weak schemas. Parquet and ORC are columnar, compressed and keep schemas, so they suit analytics and let queries skip columns.
Orchestration, tools and your project (Q33 to Q38)
# Airflow-style dependency chain (concept sketch, not run here)
extract >> validate >> load_staging >> transform >> publish- Q33. What does an orchestrator like Airflow do? It schedules tasks, manages dependencies as a directed acyclic graph (DAG), retries failures, backfills history and shows run status. It coordinates work and should not do heavy processing itself.
- Q34. How do you design a DAG for reruns? Make each task idempotent and parameterised by the run date, keep tasks small, set retries and timeouts, and avoid reading 'now' inside tasks. Then backfills and reruns are safe.
- Q35. What is dbt, and where does it fit? A tool that runs SQL transformations inside the warehouse (the T in ELT), with tests, documentation and dependency order. Orchestrators trigger dbt runs.
- Q36. How would you design a pipeline from an app database to a dashboard? Extract incrementally by timestamp or CDC, land raw files, load to staging, transform into a star schema, run quality checks, publish and monitor freshness. Say what happens on failure and on reruns.
- Q37. How do you monitor pipelines? Track job success, duration, row counts, freshness against an SLA and data quality checks. Alert on missing or late data, not only failed jobs, since a job can succeed with empty output.
- Q38. What would you do about a pipeline that fails at 3 am? Retry automatically for transient errors, alert a person for repeated failures, keep runbooks, and make reruns safe, so the fix is a rerun, not a manual repair.
Practice plan
- Redo the SQL script above on your own tables, then add a Type 2 dimension.
- Build a small ELT pipeline: download a public CSV, load to SQLite or a free-tier warehouse, transform with SQL, schedule it.
- Run Spark locally on a few hundred MB and read the Spark UI for stages and shuffles.
- Write a one-page design doc for a pipeline, covering failure, reruns, late data and quality checks.
- Pick up data engineering projects for beginners for portfolio ideas.
Frequently asked questions
What are the most asked data engineer interview questions?
SQL joins and window functions, star schema design, ETL versus ELT, idempotent loads, incremental loading and CDC, batch versus streaming, partitioning, Spark shuffles and joins, and orchestration with Airflow. Expect a pipeline design question and questions on your own project.
What is the difference between ETL and ELT?
ETL transforms data on a separate engine before loading it. ELT loads raw data into the warehouse first and transforms it there, typically with SQL. ELT is common with cloud warehouses, while ETL suits cases where data must be cleaned or masked before it lands.
Do data engineer interviews ask Spark questions for freshers?
Often yes, at a basic level: lazy evaluation, transformations versus actions, shuffles, repartition versus coalesce, joins and file formats such as Parquet. Not every role uses Spark, so check the job description, and be honest if you have only practised locally.
How is a data engineer interview different from a data analyst interview?
Analyst interviews stress SQL, metrics and communicating insight. Data engineer interviews stress pipeline design, data modelling, reliability, Python and scale. SQL matters in both. See data analyst interview questions.
What is a star schema in simple words?
One central table of events, such as orders, linked to small lookup tables, such as customers and dates. Analysts group and filter by the lookup tables and sum the numbers in the central one. It keeps analytic queries simple.
How should I prepare for a data engineer interview in a month?
Spend week one on SQL, week two on modelling and ETL design, week three on Spark and Python, and week four on a mock system design and a project walkthrough. Build one small end-to-end pipeline so you can explain real failures.
Learn this with mentors
Data and business analytics programmes with admissions open: live classes, mentors and project work.


