Skip to content

Data Engineer interview questions

100 real questions with model answers and explanations for Junior candidates.

See a Data Engineer resume example

Practice with flashcards

Spaced repetition · Hunter Pass

Questions

databasesqldecision-making

A SELECT query is written in one order but evaluated in a different logical order.

  • The written order is SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, and LIMIT.
  • Logical evaluation starts with FROM and joins, then applies WHERE, GROUP BY, HAVING, SELECT, ORDER BY, and LIMIT.
  • Because WHERE runs before SELECT and aggregation, a SELECT alias is normally unavailable in WHERE, and aggregate results belong in HAVING rather than WHERE.

Why interviewers ask this: The alias-not-visible-in-WHERE consequence shows the candidate understands evaluation order, not just syntax.

queriesaggregation

WHERE and HAVING filter data at different stages of a grouped query.

  • WHERE filters individual rows before grouping, such as keeping only rows where country = 'DE'.
  • HAVING filters groups after aggregation, such as keeping groups where SUM(amount) > 1000.
  • A condition that can be applied in WHERE should usually go there because reducing rows before aggregation lowers the amount of work.

Why interviewers ask this: The performance point about filtering early adds the engineering angle interviewers expect from this classic.

joins

The appropriate join depends on which unmatched rows the result must retain.

  • INNER JOIN keeps only rows that have a match on both sides, which suits records that must exist in both tables.
  • LEFT JOIN keeps every row from the left table and fills right-side columns with NULL when no match exists, which suits a complete customer list with or without orders.
  • FULL JOIN keeps unmatched rows from both sides, which is useful for reconciling a source and a target.

Why interviewers ask this: Mapping FULL JOIN to reconciliation work shows a data engineering perspective, not just textbook definitions.

joinsci-cd

A join multiplies rows when its key is not unique on one or both sides.

  • Every matching pair produces an output row, so a one-to-many or many-to-many join can silently inflate counts and totals.
  • Before the join, compare COUNT with COUNT(DISTINCT key) or run an equivalent uniqueness check on the expected unique side.
  • After the join, compare row counts with the expected relationship and automate these uniqueness and count checks so the pipeline fails before publishing doubled data.

Why interviewers ask this: Turning the manual check into an automated pipeline test is the engineering habit that elevates the answer.

aggregation

GROUP BY defines the result's granularity, while aggregate functions calculate a value for each group.

  • Rows with the same values in the listed grouping columns become one result group.
  • SUM, COUNT, AVG, MIN, and MAX calculate a separate result for each group.
  • Each selected column must normally be either listed in GROUP BY or wrapped in an aggregate, so the grouping columns should match the requested report granularity.

Why interviewers ask this: Framing GROUP BY as choosing granularity connects the syntax to how data engineers actually think.

schemaaggregation

COUNT variants and other aggregates treat NULL values differently.

  • COUNT(*) counts all rows, while COUNT(column) counts only rows where that column is not NULL.
  • SUM, AVG, MIN, and MAX ignore NULL values, so AVG uses only filled values and may describe a different population than expected.
  • Use COALESCE(column, 0) only when a missing value truly means zero, and inspect the share of NULL values before aggregating.

Why interviewers ask this: The changed-denominator effect of skipped NULLs is the trap this question is designed to surface.

COUNT(DISTINCT column) counts unique non-NULL values rather than rows.

  • COUNT(DISTINCT customer_id) separates the number of unique customers from the number of orders.
  • NULL is excluded, and exact distinct counting can be expensive on very large tables, so an approximate function may be suitable when an estimate is enough.
  • After joins, row multiplication may leave the distinct count unchanged and hide a fan-out error, so also validate row counts and key relationships.

Why interviewers ask this: Knowing that fan-out hides behind unchanged distinct counts shows real debugging experience.

ctesubqueries

Subqueries and CTEs both create intermediate results, so the main choice is clarity and structure.

  • A short subquery in WHERE or FROM works well for a single local task, such as comparing a value with an average.
  • A CTE declared with WITH gives each step a name and makes a multi-step transformation readable from top to bottom.
  • CTEs are common in dbt models and analytics SQL because named steps are easier to review and can be referenced again when the database supports that use.

Why interviewers ask this: Defaulting to CTEs for multi-step logic mirrors how production SQL is actually written and reviewed.

aggregationwindow-functions

A window function calculates across related rows without collapsing the original rows.

  • Every input row remains in the result and receives an additional calculated value.
  • PARTITION BY defines the related group, while ORDER BY inside OVER defines its sequence, as in ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at).
  • GROUP BY returns one row per group, while window functions can show each row's rank, previous value, or cumulative value within its group.

Why interviewers ask this: The rows-survive distinction is the conceptual core that separates understanding from memorized syntax.

querieswindow-functions

A running total of daily revenue combines daily aggregation with a windowed sum.

  • One solution is SELECT order_date, SUM(amount) AS daily_revenue, SUM(SUM(amount)) OVER (ORDER BY order_date) AS running_total FROM orders GROUP BY order_date ORDER BY order_date.
  • The inner SUM calculates revenue per day, and the outer windowed SUM accumulates those daily values from the first date through the current date.
  • Adding PARTITION BY region to the window restarts the running total for each region, provided region is also part of the daily grouping.

Why interviewers ask this: The aggregate-inside-a-window construction and the PARTITION BY follow-up are exactly what this staple tests.

dedupqueries

The usual deduplication pattern ranks rows by recency within each business key and keeps rank one.

  • Build a CTE such as WITH ranked AS (SELECT *, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) AS rn FROM customers_raw).
  • Select from that CTE with WHERE rn = 1, adding a stable tie-breaker to ORDER BY if two rows can share the same timestamp.
  • Unlike DISTINCT, this method deduplicates by the chosen business key and explicitly controls which duplicate wins.

Why interviewers ask this: This pattern is daily bread in ingestion work, and fluency with it is a strong junior signal.

unionci-cd

UNION removes duplicate result rows, while UNION ALL simply appends all rows.

  • Removing duplicates requires extra work, so UNION is usually slower than UNION ALL.
  • Pipelines should normally prefer UNION ALL when inputs cannot overlap or when duplicates are meaningful.
  • If unwanted duplicates are possible, an explicit rule based on a business key is clearer and safer than UNION's silent full-row deduplication.

Why interviewers ask this: Preferring explicit key-based dedup over UNION's silent behavior reflects pipeline-quality thinking.

aggregationqueries

Conditional aggregation uses CASE WHEN inside an aggregate to calculate segmented metrics in one query.

  • SUM(CASE WHEN status = 'paid' THEN amount ELSE 0 END) AS paid_revenue sums only paid amounts.
  • COUNT(CASE WHEN channel = 'mobile' THEN 1 END) AS mobile_orders counts rows where the condition returns a non-NULL value.
  • Several such expressions can calculate multiple report segments in one table scan instead of separate filtered queries.

Why interviewers ask this: One-pass segmented metrics via conditional aggregation is a core reporting technique interviewers check.

soft-skillsfundamentals

NULL represents an unknown value and requires SQL's dedicated NULL operators and functions.

  • Comparisons such as column = NULL and NULL = NULL evaluate to UNKNOWN rather than TRUE, so use IS NULL or IS NOT NULL.
  • NOT IN can return no rows when its subquery contains NULL, so NOT EXISTS is often the safer anti-join pattern.
  • COALESCE supplies an explicit fallback value, while NULLIF can turn a zero divisor into NULL and prevent a division-by-zero error.

Why interviewers ask this: The NOT-IN-with-NULL trap distinguishes people who have lost hours to it from people who will.

aggregation

Monthly event aggregation should group by a real month boundary that includes the year and the intended time zone.

  • A typical query uses DATE_TRUNC('month', created_at) AS month, groups by that value, and orders by it.
  • Grouping only by month number merges the same month across different years, while grouping by a formatted label can break chronological sorting.
  • Convert timestamps to the business time zone before truncation when needed, because UTC and local time can place a boundary event in different months.

Why interviewers ask this: The year-boundary and timezone caveats turn a trivial question into a check of production awareness.

The latest record per entity is usually selected with ROW_NUMBER in a window.

  • Calculate ROW_NUMBER() OVER (PARTITION BY entity_id ORDER BY event_time DESC) in a CTE or subquery and keep rn = 1 outside it.
  • Add a stable tie-breaker column to ORDER BY so two events with the same timestamp still produce one deterministic winner.
  • A join to MAX(event_time) is an alternative, but without extra tie handling it can return multiple rows for the same entity.

Why interviewers ask this: Mentioning tie handling and determinism shows the difference between a working query and a correct one.

sql

Common SQL string functions can normalize messy text before it is compared, joined, or published.

  • TRIM removes surrounding whitespace, while LOWER and UPPER normalize letter case.
  • REPLACE removes or substitutes unwanted characters, and SUBSTRING with POSITION or SPLIT_PART extracts parts of composite values.
  • A value such as an email can be normalized once during ingestion with LOWER(TRIM(email)) instead of repeating the same cleanup in downstream queries.

Why interviewers ask this: Normalize-once-at-ingestion is the architectural instinct that separates engineers from query writers.

queries

A dataset should be checked against trusted references, transformation expectations, and representative records before publication.

  • Compare totals with the source system or an established report, and track row counts at each step to locate unexpected losses or inflation.
  • Test edge cases such as NULL keys, duplicates, and date boundaries.
  • Trace two or three records from source to final output by hand, and investigate unusually good or bad numbers instead of assuming they are correct.

Why interviewers ask this: Stepwise row-count validation and record tracing form the verification discipline being screened.

queries

The first step with a slow query is to identify where the database spends time and resources rather than guess.

  • Use EXPLAIN to inspect full table scans, index or partition use, join strategy, and the number of rows processed at each stage.
  • Reduce data early with appropriate filters and select only required columns instead of SELECT *.
  • Check whether join and filter columns have useful indexes in a row database or whether WHERE uses the partition column in a partitioned system.

Why interviewers ask this: Plan-first diagnosis instead of folklore optimizations is the habit interviewers want confirmed.

DDL defines database structures, while DML works with the data stored in those structures.

  • DDL includes CREATE, ALTER, and DROP for objects such as tables, schemas, and indexes.
  • DML includes INSERT, UPDATE, DELETE, and MERGE, while SELECT reads data and is sometimes classified separately as DQL.
  • Destructive DDL such as DROP or TRUNCATE needs extra care because rollback behavior varies by database and recovery may be difficult or impossible.

Why interviewers ask this: The rollback asymmetry between schema and data operations is the practical takeaway expected.

Locked questions

  • 21

    What are primary and foreign keys, and what role do they play in analytics databases?

    databaseforeign-keys
  • 22

    What constraints exist in SQL, and why do they matter for data loads?

    sql
  • 23

    What is a view, and how does a materialized view differ?

    materialized-views
  • 24

    What is a transaction, and why do transactions matter for data loading?

    transactions
  • 25

    What is an index, and why not index every column?

    indexesschema
  • 26

    What is the difference between OLTP and OLAP databases?

    database
  • 27

    What is normalization, and what problems does it solve?

    normalization
  • 28

    Why do analytics schemas deliberately denormalize?

    schemadenormalization
  • 29

    What are fact and dimension tables in a star schema?

    schemamodeling
  • 30

    What is the difference between a star schema and a snowflake schema?

    schemamodelingsnowflake
  • 31

    What is the grain of a fact table, and why is it the first design decision?

    modelingdesign
  • 32

    What is a surrogate key, and why use one instead of the natural key?

  • 33

    What are slowly changing dimensions, and what is the difference between SCD type 1 and type 2?

    scd
  • 34

    When would you choose a relational database and when a NoSQL store?

    nosqldatabase
  • 35

    What is a data warehouse, and how does it differ from an application database?

    databasewarehouse
  • 36

    What is a data lake, and how does it relate to a warehouse?

    warehouse
  • 37

    Why do analytical databases use columnar storage?

    databaseschema
  • 38

    What is table partitioning, and what does it give a pipeline?

    partitioningci-cd
  • 39

    What are the strengths and traps of CSV as a data format?

  • 40

    When is JSON the right format in pipelines, and what are its costs?

    ci-cd
  • 41

    Why has Parquet become the default file format for analytical data?

  • 42

    The source system added a new column to its export. What happens to your pipeline, and how should it be handled?

    schemasystem-designci-cd
  • 43

    Why compress data files, and what should a junior know about compression choices?

  • 44

    What is object storage like S3, and why does data engineering live on it?

    aws
  • 45

    How do you organize data in a bucket so it stays usable as it grows?

  • 46

    What does it mean for a data load to be idempotent, and how do you achieve it?

    idempotency
  • 47

    What is the difference between a full load and an incremental load?

    pipelines
  • 48

    How does an incremental load know what is new? Explain the watermark approach.

    pipelines
  • 49

    What is an upsert, and when does a pipeline need MERGE?

    ci-cd
  • 50

    What is dbt, and what problems does it solve for a data team?

    dbt
  • 51

    What is ETL, and what happens at each stage?

    etl
  • 52

    What is the difference between ETL and ELT, and why did ELT take over?

    etl
  • 53

    Design a simple pipeline that loads data from a REST API into a warehouse daily.

    restdesignwarehouse
  • 54

    What do pagination and rate limits mean when extracting from an API?

    paginationrate-limiting
  • 55

    How should a pipeline handle records that fail validation mid-run?

    validationci-cd
  • 56

    What is Airflow, and what are DAGs and tasks?

    airflow
  • 57

    What is a backfill, and what must be true for it to be safe?

    backfill
  • 58

    What is the difference between batch and streaming processing, and when is each appropriate?

    streamingbatchconcurrency
  • 59

    What is Kafka at a high level, and what problem does it solve?

    kafka
  • 60

    What is Spark, and when do you need it instead of pandas?

    pandas
  • 61

    Why is plain cron not enough for orchestrating real data pipelines?

    pipelinesorchestrationcron
  • 62

    What should be monitored in data pipelines, beyond whether the job ran?

    monitoringci-cdpipelines
  • 63

    What is data freshness, and how do you implement a freshness check?

    consistency
  • 64

    What should pipeline logs contain to make failures debuggable?

    ci-cd
  • 65

    How do you process a CSV file in Python that is larger than memory?

    concurrencypythonmemory
  • 66

    You load a file into pandas. What do you check before transforming anything?

    pandas
  • 67

    How does merging DataFrames in pandas go wrong, and how do you protect yourself?

    pandas
  • 68

    How do you handle missing values in pandas during pipeline processing?

    concurrencypandassoft-skills
  • 69

    Where should transformations live, in SQL or in Python?

    sqlpython
  • 70

    How do you call an HTTP API reliably from a Python extraction script?

    httppython
  • 71

    An API returns deeply nested JSON. How do you turn it into flat tables?

    api
  • 72

    How do you manage Python dependencies for pipeline code?

    dependenciesci-cdpython
  • 73

    How do you test pipeline transformation code?

    ci-cd
  • 74

    Why do SQL models, DAGs, and pipeline configs belong in git?

    gitconfigci-cd
  • 75

    You review a colleague's pipeline pull request. What do you look at?

    code-reviewci-cd
  • 76

    What dimensions describe data quality, and why name them explicitly?

    quality
  • 77

    How do you handle data quality issues in a pipeline?

    qualitysoft-skillsci-cd
  • 78

    Where do duplicates come from in pipelines, and how do you defend against them?

    ci-cd
  • 79

    A column that should never be NULL starts arriving 30 percent NULL. What do you do?

    schemafundamentals
  • 80

    How do you verify that a load moved all the data correctly from source to target?

  • 81

    How should timestamps and time zones be handled in a data platform?

  • 82

    What is late-arriving data, and how do batch pipelines cope with it?

    batchci-cd
  • 83

    What counts as PII, and what rules should a junior follow when handling it?

    pii
  • 84

    How should access to data in a warehouse be organized?

    warehouse
  • 85

    A production table was dropped or corrupted by mistake. What are the recovery options?

    ownership
  • 86

    How do development and production environments work for data pipelines?

    pipelinesci-cd
  • 87

    What makes queries expensive in cloud warehouses, and how do you write cost-aware SQL?

    sqlquerieswarehouse
  • 88

    Why document datasets, and what does minimal useful documentation contain?

    documentation
  • 89

    You arrive in the morning and the overnight pipeline run failed. Walk through your routine.

    ci-cd
  • 90

    A stakeholder says the dashboard numbers look wrong. How do you investigate?

    stakeholder-managementcommunication
  • 91

    You get a request: load this data into the warehouse. What do you clarify before building?

    warehouse
  • 92

    You need to rename and restructure a table that other teams query. How do you roll out the breaking change?

    queriesversioning
  • 93

    Your load doubled rows in a production table and reports went out wrong. What do you do?

  • 94

    Ad-hoc data requests keep interrupting your pipeline project. How do you balance them?

    ci-cd
  • 95

    How do you grow as a junior data engineer?

  • 96

    How long do you dig into a problem alone before asking for help?

  • 97

    A senior engineer proposes an approach you think is wrong. How do you handle it?

    soft-skills
  • 98

    Two source systems disagree on the same metric, and both owners insist theirs is right. What do you do?

    conflictsystem-designmonitoring
  • 99

    You join a team with dozens of existing pipelines. How do you get productive?

    joinsci-cd
  • 100

    What qualities make a strong data engineer beyond tool knowledge?