Interview Insights · Data Engineer
Why Every Data Engineer Should Practice Explaining Their Model Aloud
Quick summary — DE data model
When I ask a data engineer about their model, the first sentence I want is the grain: what exactly does one row in the fact table represent? In this article, 'model' means the data model rather than a machine learning model. Many candidates can draw a star schema but cannot say what one row means, how history is kept when a customer changes city, or why they chose a star over a normalised design. These are spoken skills. Practising them aloud gives you a short, confident explanation and calm answers to the follow-ups.
In this guide you will learn:
- How to state the grain of a fact table in one sentence
- How to explain a star schema without hiding behind jargon
- What to say about SCD Type 2, with working SQL
- How to defend modelling trade-offs such as star versus normalised
- A rehearsal worksheet for the model in your own project
SECTION 01Start with the grain: what does one row mean?
The grain is the most important sentence in any data model explanation. 'One row per order line' and 'one row per order' sound similar, but they produce very different totals. If a candidate cannot tell me the grain, I usually find a double-counting bug in their model within a few questions.
Practise saying the grain before anything else. Then list the measures, which must all make sense at that grain, and then the dimensions that give each row its context. That order is easy to follow when spoken, and it shows you designed the model rather than inherited it.
| Fact table | Grain statement | Typical measures | Common mistake |
|---|---|---|---|
| fact_order_line | One row per product line in an order | Quantity, unit price, discount | Putting order-level shipping fee on every line |
| fact_daily_inventory | One row per product per store per day | Units on hand, units reserved | Summing on-hand stock across days |
| fact_page_view | One row per page view event | View count of 1, time on page | Mixing sessions and views in one table |
| fact_payment | One row per payment attempt | Amount, success flag | Treating failed attempts as revenue |
CREATE TABLE dim_date (
date_key INT PRIMARY KEY, -- e.g. 20240305
full_date DATE NOT NULL,
month_name VARCHAR(10),
is_weekend BOOLEAN
);
CREATE TABLE dim_product (
product_key INT PRIMARY KEY,
product_id VARCHAR(20) NOT NULL, -- natural key from source
category VARCHAR(50),
brand VARCHAR(50)
);
CREATE TABLE fact_order_line (
order_id VARCHAR(20) NOT NULL,
line_number INT NOT NULL,
date_key INT NOT NULL REFERENCES dim_date(date_key),
product_key INT NOT NULL REFERENCES dim_product(product_key),
customer_key INT NOT NULL,
quantity INT NOT NULL,
unit_price NUMERIC(10,2) NOT NULL,
discount NUMERIC(10,2) DEFAULT 0,
PRIMARY KEY (order_id, line_number)
);"The centre is fact_order_line. One row is one product
line inside an order, so the key is order_id plus
line_number.
The measures are quantity, unit price and discount.
All of them make sense per line, which is how I checked
the grain was right.
Around it are date, product and customer dimensions.
Shipping fee is charged per order, not per line, so I
kept it in a separate order-level fact. Otherwise any
sum of shipping would be multiplied by the line count."
The shipping fee detail is the kind of thing that convinces me you thought about the grain. It shows you checked every measure against the definition of a row, instead of putting every column you had into one table.
SECTION 02Explaining history: slowly changing dimensions without jargon
My favourite follow-up is simple: 'A customer moves from Delhi to Pune. What happens to last year's sales by city?' If you overwrite the city, last year's Delhi sales suddenly appear under Pune. Sometimes that is what the business wants. Often it is not.
You may know the names SCD Type 1 and Type 2, but in the interview, explain them as behaviour first and give the name second. 'We keep the old row, close it with an end date and add a new row for Pune' is clearer than 'we use SCD2'. Then be ready to show the SQL.
| Approach | What happens on change | Effect on old reports | When to use |
|---|---|---|---|
| Type 1 (overwrite) | Old value replaced | History shows the new value | Corrections such as a fixed spelling |
| Type 2 (new row) | Old row closed, new row added | History keeps the old value | City, segment, plan: anything analysed over time |
| Type 3 (extra column) | Previous value stored in a column | Only one prior value kept | Rare; a single known reorganisation |
| Snapshot table | Full copy taken each day | Any date can be reproduced | Small dimensions or audit needs |
-- dim_customer: customer_key (identity), customer_id, city, segment,
-- valid_from, valid_to, is_current
-- PostgreSQL syntax
-- Step 1: close current rows whose tracked columns changed
UPDATE dim_customer AS d
SET valid_to = CURRENT_DATE - 1,
is_current = FALSE
FROM stg_customer AS s
WHERE d.customer_id = s.customer_id
AND d.is_current = TRUE
AND (d.city IS DISTINCT FROM s.city
OR d.segment IS DISTINCT FROM s.segment);
-- Step 2: insert a current row for new and changed customers
INSERT INTO dim_customer (customer_id, city, segment,
valid_from, valid_to, is_current)
SELECT s.customer_id, s.city, s.segment,
CURRENT_DATE, DATE '9999-12-31', TRUE
FROM stg_customer AS s
LEFT JOIN dim_customer AS d
ON d.customer_id = s.customer_id
AND d.is_current = TRUE
WHERE d.customer_id IS NULL;"I run it in two steps.
First, any current customer row whose city or segment
changed gets an end date of yesterday and is marked
not current.
Second, I insert a fresh current row for every staging
customer who no longer has a current row. That covers
both brand-new customers and the ones I just closed.
I use IS DISTINCT FROM instead of not-equals so that a
change from NULL to a value is still detected.
Facts store customer_key, so each sale points to the
version of the customer that was true on that day."
The last spoken sentence is the one most candidates miss. SCD Type 2 only preserves history if the fact table stores the surrogate key of the version that was current at the time of the sale. If facts store the natural customer_id, the history in the dimension is never used.
SECTION 03Defending your modelling choices when challenged
Once your model is on the table, I will push on its shape. Why a star and not third normal form? Why surrogate keys? Why is this table partitioned by date? A candidate who answers 'that is the standard way' has not finished the thought. Every choice has a reason and a cost, and saying both aloud is what makes it a decision.
The goal is not to be right about everything. It is to show that you know what you gave up. A star schema trades some storage and update complexity for simpler, faster analytical queries. Say that sentence and you have answered the question.
| Choice | What you gain | What you give up | Short spoken line |
|---|---|---|---|
| Star schema | Simple joins, fast BI queries | Some duplicated attributes | Analysts query it daily, so simple joins win |
| Surrogate keys | Stable keys, supports SCD2 | Extra lookup during loads | Source IDs change; our keys must not |
| Partition by date | Fast date filters, cheap reloads | Small files if overdone | Most queries filter on a recent date range |
| Wide denormalised table | Easiest for dashboards | Hard to keep consistent | Built on top of the star, not instead of it |
-- Monthly revenue by category and customer city,
-- using the city that was true at the time of each sale
SELECT d.month_name,
p.category,
c.city,
SUM(f.quantity * f.unit_price - f.discount) AS net_revenue
FROM fact_order_line AS f
JOIN dim_date AS d ON d.date_key = f.date_key
JOIN dim_product AS p ON p.product_key = f.product_key
JOIN dim_customer AS c ON c.customer_key = f.customer_key
WHERE d.full_date >= DATE '2024-01-01'
GROUP BY d.month_name, p.category, c.city
ORDER BY d.month_name, net_revenue DESC;Q: Why not keep it normalised like the source database?
A: "The source is designed for writing orders quickly,
so it is split into many small tables. Our users are
analysts who read far more than they write.
With the star, most questions are one fact table plus
three or four dimension joins, like the revenue query.
In the normalised source the same question needs many
more joins and is easy to get wrong.
The cost is that I have to maintain the dimensions and
handle history myself, which the SCD job does."
Notice that the revenue query reads like the business question. That is the strongest argument for your model, and running a query like this during your explanation, even on paper, makes the design concrete.
SECTION 04Worksheet: rehearse your data model explanation
Use this for the main model in your project or portfolio. Fill it in writing, then explain it aloud in under three minutes and record yourself.
MY DATA MODEL
Business process modelled: _______________________
Fact table name: ________________________________
Grain (one row = ...): ___________________________
Measures (each checked against grain): ___________
Dimensions: _____________________________________
Which dimension keeps history, and how: __________
Partitioning or clustering choice: _______________
One query this model makes easy: ________________PRACTISE ANSWERING ALOUD
- What does one row in your fact table mean?
- Which measure would break if the grain changed?
- A product moves to a new category. What happens?
- Why surrogate keys instead of source IDs?
- Why not one wide table for everything?
- How do you handle a fact that arrives before its
dimension row exists? (late-arriving dimension)
- How would you add a new source to this model?AFTER YOUR RECORDING
[ ] Grain stated in the first 20 seconds
[ ] Measures explained as making sense at that grain
[ ] History explained as behaviour, then named
[ ] Mentioned facts storing the surrogate key
[ ] Gave one gain and one cost for the star schema
[ ] Walked through one real query
Weakest point: ______________________
SECTION 05Habits that make your model explanation clear
Data models are visual, but interviews are often spoken or done over a call. These habits help you explain structure without a perfect diagram.
- Say the grain twice — State it at the start and repeat it when you reach the measures. Repetition helps the listener keep the model in their head.
- Use one example row — Describe a single row, such as 'order 1045, line 2, two units of a phone case', to make the grain concrete.
- Name the late-arriving case — Mentioning how you handle a fact whose customer is not loaded yet, for example with an 'unknown' row, shows real loading experience.
- Keep the diagram small — Draw one fact and three or four dimensions. Extra tables can be mentioned in words.
- Link the model to a question — Every table should exist because someone asks a question that needs it. Say which question.
SECTION 06Interview Q&A — DE data model
Q1What is the grain of a fact table?
The grain is the exact meaning of one row, such as one order line, one payment attempt or one product per store per day. Every measure in the table must make sense at that level, and choosing the grain is the first step in designing a fact table.
Q2Explain the difference between SCD Type 1 and Type 2.
Type 1 overwrites the old attribute value, so history shows the latest value. Type 2 closes the old row with an end date and inserts a new row with the new value, so reports for past dates still show what was true then. Facts must store the surrogate key for Type 2 to work.
Q3Why use surrogate keys in a data warehouse?
Surrogate keys are keys created by the warehouse. They stay stable even if source IDs change or two sources reuse the same ID, and they allow several versions of the same customer to exist for SCD Type 2. The cost is a key lookup during fact loading.
Q4When would you choose a star schema over a normalised model?
For analytical workloads, where people mostly read and aggregate data. A star schema keeps queries to a fact table and a few dimension joins, which is faster and easier to write. Normalised models suit transactional systems where many small writes must stay consistent.
Q5How do you handle a fact that arrives before its dimension row?
A common approach is to point the fact to a placeholder or 'unknown' dimension row, or to create an inferred dimension row with just the natural key. When the full dimension data arrives, the inferred row is updated. The key is not to drop the fact.
SECTION 07Test yourself — DE data model quiz
Five questions. No sign-up.
0 / 5Pick an answer to see why it is right or wrong.
SECTION 08Frequently asked questions
What data modelling questions are asked in data engineer interviews?
Common questions cover fact and dimension tables, grain, star versus snowflake schemas, slowly changing dimensions, surrogate keys, late-arriving data and how you would model a specific business process such as orders or subscriptions.
What is the difference between a star schema and a snowflake schema?
In a star schema, each dimension is a single denormalised table joined directly to the fact. In a snowflake schema, dimensions are split into further related tables, such as product linked to a separate category table. Stars are simpler to query; snowflakes reduce some redundancy.
How do I explain my data model in an interview?
State the grain first, then list the measures and check each one against the grain, then describe the dimensions, then explain how history is handled. Finish with one real query the model makes easy.
Is SCD Type 2 asked to freshers?
It is commonly asked in data engineering and warehouse roles, including for freshers. You should be able to explain it in plain words and write or describe the SQL that closes old rows and inserts new ones.
What is a surrogate key in simple words?
It is an ID created inside the data warehouse, usually a number, used instead of the ID from the source system. It stays stable and allows several historical versions of the same record.
How can I prepare for Data Engineer interview answers with a trainer?
Yes. Uncodemy's Data Science Training Course in Noida (classroom and online) includes live projects, one-to-one mock interviews and resume reviews, so you practise Data Engineer interview answers with trainer feedback before the real interview. You can book a free demo class from this page to see how the sessions work.
SECTION 09Related reads
Classroom & online · Noida
Design data models you can defend
Our Data Science Training Course covers SQL, warehousing, dimensional modelling and pipelines, with spoken reviews where you explain your model out loud before interviews.
Talk to a counsellor for current fees- Star schema projects
- SCD and history handling
- Advanced SQL practice
- Spoken model reviews