Data modeling interview questions: entities, keys, normalization and grain
Data modeling interview questions ask you to turn a business description into tables and relationships, then defend the choices: which entities exist, how they relate, what uniquely identifies a row, how far to normalize, and what one row of each table means. Interviewers test conceptual, logical and physical models, normalization versus denormalization, surrogate versus natural keys, and whether you model differently for an application database than for analytics.
By Evin JohnPublished 8 min read
How data modeling is tested
Modeling questions show up in data engineer, analytics engineer, database developer, backend and data architect interviews. There are usually two parts. A concept part checks vocabulary: model levels, normal forms, key types, cardinality. A live exercise gives you a short scenario, such as a ride-sharing app, a clinic's appointments or an online course platform, and asks you to sketch the tables on a whiteboard or in a shared document while thinking aloud. The exercise is where the signal is: interviewers watch whether you ask clarifying questions, state assumptions, and change the model when they add a requirement.
Model levels and ER basics
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Conceptual, logical and physical models: what is the difference? | Levels of detail | Conceptual names the business entities and how they relate, for business readers. Logical adds attributes, keys and cardinality without tying itself to a database. Physical maps it to a specific engine: tables, data types, constraints, indexes and partitioning. |
| What is an entity, an attribute and a relationship? | Vocabulary | An entity is a thing the business tracks (customer, order). An attribute describes it (email, order date). A relationship links entities (a customer places orders). |
| Explain cardinality and optionality. | Precision | Cardinality says how many: one-to-one, one-to-many, many-to-many. Optionality says whether the link is required: an order must have a customer, but a customer may have no orders yet. |
| How do you read crow's foot notation? | Diagrams | The crow's foot marks the many side, a bar marks one, and a circle marks optional. Reading both ends gives sentences such as each customer places zero or more orders. |
| How do you implement a many-to-many relationship? | Patterns | With an associative (junction) table holding both foreign keys, often with attributes of its own, such as enrollment date and status between students and courses. |
| What is a weak entity? | ER depth | An entity that cannot be identified without its parent, such as an order line identified by order and line number. Its key includes the parent's key. |
| What is an identifying versus non-identifying relationship? | Keys and relationships | In an identifying relationship the parent's key is part of the child's primary key. In a non-identifying one, the child has its own key and the parent's key is only a foreign key. |
| Who uses each level of model? | Communication | Business stakeholders review the conceptual model, analysts and architects agree the logical one, and engineers build and tune the physical one. |
Normalization and denormalization
- Why normalize at all? To store each fact once. Without it you get update anomalies (a customer's address changed in one row but not another), insert anomalies (you cannot record a product until someone orders it) and delete anomalies (deleting the last order erases the customer).
- Walk through 1NF, 2NF and 3NF with an example. An orders sheet with a comma-separated list of products breaks 1NF, so split it into one row per order line. If the line table's key is order id plus product id and it also holds product name, that name depends on only part of the key, which breaks 2NF, so move it to a product table. If the order row holds the customer's city, which depends on the customer rather than the order, that breaks 3NF, so move it to the customer table.
- What does BCNF add? Every determinant must be a candidate key. It matters in tables with overlapping candidate keys, which are rare in practice but popular in exams.
- When do you denormalize? For read-heavy analytics, reporting tables and caches, when joins cost more than the extra storage and update work. Denormalize on purpose, with a refresh process, rather than by accident.
- What does denormalization cost you? Duplicated data that must be kept in sync, bigger rows, and harder writes. In an application database that usually means bugs; in a rebuilt-nightly analytics table it is often fine.
- Is one big table a good analytics model? Wide, pre-joined tables are fast and easy for analysts, and columnar engines handle them well. They get hard to maintain when many teams need different grains, so many teams build dimensional models first and wide tables on top.
Keys and identity
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Natural key versus surrogate key? | Core trade-off | A natural key comes from the business (email, ISBN, tax id). A surrogate key is generated (an integer sequence or UUID) and has no meaning. Surrogates stay stable when business values change and keep joins narrow. |
| If you use a surrogate key, what do you do with the natural key? | Integrity | Keep a unique constraint on it. Otherwise the same customer can be inserted twice with two surrogate keys and nothing stops it. |
| What are candidate, primary, alternate and composite keys? | Vocabulary | Candidate keys are minimal sets of columns that identify a row. One is chosen as primary; the others are alternate keys. A composite key uses more than one column. |
| Integer sequence or UUID? | Physical design | Sequences are compact and ordered, which helps index locality, but reveal counts and need coordination across systems. UUIDs can be generated anywhere; random ones scatter inserts in a B-tree, which time-ordered variants avoid. |
| Why use a surrogate key in a dimension instead of the source system id? | Analytics keys | Sources change or collide when you integrate several systems, and keeping history means one source id maps to several rows. The warehouse key gives each version its own identity. |
| Should foreign keys be enforced? | Integrity versus speed | In application databases, yes: they prevent orphans cheaply. Some analytics platforms only record them as informational, so the load process and tests must enforce them instead. |
CREATE TABLE customer (
customer_id INTEGER PRIMARY KEY, -- surrogate key
email TEXT NOT NULL UNIQUE, -- natural key, kept unique
full_name TEXT NOT NULL,
created_at TEXT NOT NULL
);
CREATE TABLE course (
course_id INTEGER PRIMARY KEY,
code TEXT NOT NULL UNIQUE, -- e.g. 'SQL-101'
title TEXT NOT NULL
);
-- Many-to-many: a customer enrolls in many courses, a course has many customers
CREATE TABLE enrollment (
customer_id INTEGER NOT NULL REFERENCES customer (customer_id),
course_id INTEGER NOT NULL REFERENCES course (course_id),
enrolled_at TEXT NOT NULL,
status TEXT NOT NULL CHECK (status IN ('active', 'completed', 'cancelled')),
PRIMARY KEY (customer_id, course_id) -- one enrollment per pair
);A good follow-up to expect: what if a customer can cancel and enroll again later? Then the pair is no longer unique over time. Either give enrollment its own surrogate id and allow several rows per pair, or keep one row and move the history of status changes to a separate table.
Modeling for analytics
- What does declaring the grain mean? Writing down exactly what one row of a table represents, such as one row per order line per day, before choosing columns. Mixed grains in one table cause double counting.
- What are the steps of dimensional design? Pick the business process, declare the grain, identify the dimensions that describe each row, then identify the numeric facts measured at that grain.
- How does an analytics model differ from an application model? Application models are normalized for correct, concurrent writes of single records. Analytics models are shaped for reading: fewer joins, descriptive attributes copied onto dimensions, history kept, and names business users understand.
- How would you model events from a product, such as clicks and page views? An event table at one row per event, with a timestamp, user and session keys, an event name and a semi-structured properties column, plus modeled tables on top for the events that matter, such as sessions or funnels.
- What is Data Vault, briefly? A method for the integration layer: hubs hold business keys, links hold relationships between hubs, and satellites hold descriptive attributes with load dates. It absorbs new sources and changes without redesign, at the cost of many joins, so reporting models sit on top.
- Where do metrics definitions belong? In one shared layer, such as a semantic layer or a set of governed models, so revenue or active users mean the same thing in every dashboard.
Advanced and tricky modeling questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| How do you model a hierarchy such as an org chart or category tree? | Recursive data | An adjacency list (each row points to its parent) is simplest and works with recursive queries. A closure table stores every ancestor-descendant pair for fast subtree reads. A path column suits read-heavy trees. |
| How do you model data that changes over time? | Temporal design | Valid-from and valid-to columns for when a fact was true in the business, and separate recorded-at columns for when the system learned it, if audits need both. |
| How do you handle soft deletes? | Lifecycle | A deleted-at column keeps the row for history and audits, but every query and unique constraint must account for it, and privacy rules may require real deletion. |
| A comment can belong to a post, a photo or a video. How do you model it? | Polymorphism | Separate nullable foreign keys with a check that exactly one is set keeps referential integrity. A type column plus a generic id is flexible but the database cannot enforce the link. |
| How would you model the same data in a document or key-value store? | NoSQL | Start from access patterns, not entities. Embed data that is read together and bounded in size, reference data that grows without limit, and accept duplication for read speed. |
| How do you change a model without breaking consumers? | Evolution | Add columns rather than renaming, deprecate with a timeline, version tables or views when meaning changes, and use contracts or tests so producers find out before consumers do. |
| Where would you store money and time? | Physical details | Money in a fixed-point decimal or integer minor units with a currency code, never floating point. Times in UTC with a time zone stored where local time matters. |
| How do you validate a model before building it? | Process | Walk sample records and real questions through it: can you answer the top reports, does every row have one clear meaning, can a new requirement be added without a rewrite. |
Fictional example
- Interviewer
- We run several clinics. Patients book appointments with therapists. Sketch the data model.
- Candidate
- I will start with a few questions. Do therapists work at more than one clinic? Can an appointment include more than one therapist? Do we need to keep cancelled and rescheduled appointments? Let us say therapists can work at several clinics, one therapist per appointment, and we keep cancellations. Then the core entities are patient, therapist, clinic and appointment. Therapist to clinic is many-to-many, so I add a therapist_clinic table, maybe with the weekdays they work there. An appointment belongs to one patient, one therapist and one clinic, with a start time, an end time and a status. I would give each table a surrogate key and keep natural identifiers unique, such as the patient's record number. Rescheduling is the interesting part: if the business wants to know how often appointments move, I would not overwrite the time. I would keep the appointment row and add an appointment_change table with the old time, the new time and who changed it. For reporting I would later build a fact table at one row per appointment with clinic, therapist, patient and date dimensions.
How to prepare for data modeling interview questions
- Model five everyday systemsA library, a food delivery app, a hotel booking site, a school timetable and a subscription product. Do each at the conceptual level first, then logical, in under 20 minutes.
- Practice saying the grainFor every table you draw, finish the sentence one row means... out loud. If you cannot, the table is not ready.
- Normalize a messy sheetTake a flat spreadsheet export and bring it to 3NF step by step, naming the anomaly each step removes.
- Build it physically onceWrite the DDL with keys and constraints in any SQL database, insert rows that should fail, and confirm they do.
- Rehearse the change requestAsk a friend to add a twist halfway through, such as multiple currencies or shared accounts, and practice adapting without starting over.
Modeling questions lead naturally into warehouse design: data warehouse interview questions covers star schemas, fact types and slowly changing dimensions, and Snowflake interview questions covers a platform where these models often live. For choosing a database to begin with, see SQL versus NoSQL in system design. Analysts get modeling questions too; the data analyst interview questions page shows how.
A live modeling exercise is mostly talking while you draw. Natively, an AI interview assistant for Mac and Windows, captures a transcript of that talk in a practice session, can suggest entities or follow-up questions as you go, and reads a whiteboard photo, an ER diagram or a scenario prompt from a screenshot. With Pro or the free trial it can work from your résumé and the job description, and every mock's transcript and notes are kept so you can see where your explanation wandered.
Questions people ask
What are common data modeling interview questions?
The difference between conceptual, logical and physical models, cardinality, how to model many-to-many relationships, normal forms, when to denormalize, natural versus surrogate keys, declaring the grain, and a live exercise to model a small business.
What is the difference between a logical and a physical data model?
A logical model defines entities, attributes, keys and relationships independent of any database. A physical model implements it for a specific engine with tables, data types, constraints, indexes and partitioning.
Should I use a surrogate key or a natural key?
Usually a surrogate key as the primary key for stability and narrow joins, while keeping a unique constraint on the natural key so duplicate records are still rejected.
How do I approach a live data modeling exercise?
Ask clarifying questions, list the entities and relationships first, state the grain of each table, add keys and attributes, and say your assumptions out loud so you can adapt when the interviewer adds a requirement.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
