Interview prep

Real questions for analytics engineer, data analyst and BI interviews, with clear model answers, a quiz, and a 7-day game plan.

54 flashcards30 quiz questions8 topics
I'll be your interviewer today. Relax, I only bite bugs.

Answer out loud first, then tap or press Space to flip.

 or  . Use the arrow keys to move between cards.

Every question, answered.

Model answers you can adapt in your own words. Search for a topic or browse by category.

SQL

What's the difference between WHERE and HAVING?

WHERE filters individual rows before grouping. HAVING filters groups after aggregation, so it can use functions like COUNT or SUM. Example: WHERE status = 'paid' keeps paid orders; HAVING COUNT(*) > 5 keeps customers with more than five of them.

Explain INNER JOIN versus LEFT JOIN.

An INNER JOIN returns only rows with a match in both tables. A LEFT JOIN returns every row from the left table, with NULLs where the right table has no match. Use a LEFT JOIN when missing matches matter, for example to find customers with no orders.

ROW_NUMBER, RANK and DENSE_RANK: what's the difference?

All three number rows within a window. ROW_NUMBER always gives unique numbers (1, 2, 3). RANK gives ties the same number and skips the next ones (1, 1, 3). DENSE_RANK gives ties the same number without gaps (1, 1, 2).

UNION versus UNION ALL?

Both stack the results of two queries. UNION removes duplicate rows, which costs a sort or hash. UNION ALL keeps everything and is faster, so use it whenever duplicates are impossible or wanted.

How do you find duplicate rows?

Group by the columns that should be unique and keep groups with more than one row: SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1. To see or delete the extra copies, use ROW_NUMBER() OVER (PARTITION BY email ORDER BY created_at) and keep row 1.

What is a CTE and why use one?

A Common Table Expression (WITH name AS (...)) is a named, temporary result you can reference in the rest of the query. CTEs make complex logic readable step by step, can be referenced more than once, and support recursion for hierarchies.

Why can NOT IN return no rows unexpectedly?

If the subquery returns even one NULL, x NOT IN (...) evaluates to unknown for every row, so nothing comes back. NOT EXISTS doesn't have this problem, which is why it's the safer way to write anti joins.

How would you find the second highest salary?

Rank salaries and pick rank 2: SELECT salary FROM (SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS r FROM employees) t WHERE r = 2. DENSE_RANK handles ties correctly. Alternatives use MAX with a subquery, or ORDER BY with OFFSET.

COUNT(*), COUNT(column) and COUNT(DISTINCT column)?

COUNT(*) counts all rows. COUNT(column) counts rows where that column isn't NULL. COUNT(DISTINCT column) counts unique non-NULL values. Mixing them up is a common source of wrong metrics.

Python

List, tuple, set and dictionary: when do you use each?

A list is ordered and changeable, for sequences. A tuple is ordered and immutable, good for fixed records and dictionary keys. A set holds unique values with fast membership checks. A dictionary maps keys to values with fast lookup by key.

What's wrong with def f(items=[])?

Default arguments are created once, when the function is defined, so the same list is shared between calls and keeps growing. Use items=None and create a new list inside the function.

What is a generator and why use one?

A generator produces values one at a time with yield, instead of building a whole list in memory. It's ideal for large files or streams: you can process millions of rows with constant memory.

pandas: merge, join or concat?

merge combines DataFrames on columns, like a SQL join. join is a shortcut that joins on the index. concat stacks DataFrames vertically or side by side without matching keys. Use merge with validate='one_to_one' or 'many_to_one' to catch duplicate keys.

Why avoid apply() in pandas when possible?

apply runs a Python function row by row, which is slow. Vectorised operations such as df['a'] * df['b'], .str methods or numpy.where work on whole columns at once in optimised code, often 10 to 100 times faster.

How do you handle missing data in pandas?

First measure it with df.isna().sum(). Then decide per column: drop rows (dropna) when few and random, fill with a sensible value (fillna) such as 0 or the median, or flag it in a new column. Never fill blindly: missing values often carry meaning.

Shallow copy versus deep copy?

A shallow copy creates a new outer object but shares nested objects, so changing a nested list changes both. A deep copy (copy.deepcopy) duplicates everything. In pandas, df.copy() is deep by default, which avoids the SettingWithCopy confusion.

Data modelling

What are fact and dimension tables?

Fact tables record events or measurements, such as sales or sessions: long, narrow and numeric, with keys to dimensions. Dimension tables describe the context, such as customer, product, date or store: shorter and wide, full of attributes you filter and group by.

What is the grain of a fact table and why does it matter?

The grain is what one row represents, for example 'one row per order line'. Defining it first prevents double counting, keeps every measure consistent and makes joins predictable. Choose the lowest useful grain.

Star schema versus snowflake schema?

In a star schema each dimension is a single denormalised table joined directly to the fact. In a snowflake schema dimensions are normalised into several related tables. Stars are simpler and faster for BI; snowflakes reduce duplication at the cost of more joins.

Explain slowly changing dimensions Type 1 and Type 2.

Type 1 overwrites the old value, so history is lost; good for corrections. Type 2 adds a new row with valid_from, valid_to and an is_current flag, preserving history so reports show values as they were at the time. dbt snapshots implement Type 2.

Surrogate key versus natural key?

A natural key comes from the business or source system, such as an email or product code. A surrogate key is a meaningless identifier created in the warehouse. Surrogates protect you when source IDs change, collide across systems or need history tracking.

Normalised or denormalised for analytics?

Operational systems normalise to avoid update anomalies. Analytics usually denormalises into star schemas because reads vastly outnumber writes, and fewer joins make queries faster and easier for people to understand.

OLTP versus OLAP?

OLTP systems handle many small, fast transactions, such as placing orders, and usually store data row by row. OLAP systems handle large analytical queries across history, and usually store data by column. PostgreSQL is typical OLTP; Snowflake and BigQuery are OLAP.

Analytics engineering and dbt

What does an analytics engineer do?

They turn raw data into clean, tested, documented models that analysts, dashboards and data science can trust. The role sits between data engineering and analysis, and brings software practices such as version control, testing and CI to analytics.

ETL versus ELT?

ETL transforms data before loading it into the warehouse. ELT loads raw data first and transforms it inside the warehouse with SQL. Cheap, scalable cloud warehouses made ELT the modern default, and it's how tools like dbt work.

Why use ref() in dbt instead of table names?

ref() tells dbt how models depend on each other, so it can build them in the right order, draw the lineage graph, and point to the correct schema in each environment, such as development or production.

What are dbt's main materialisations?

view: always fresh, no storage, slower to query. table: rebuilt each run, fast to query. incremental: only processes new or changed rows, for large tables. ephemeral: inlined as a CTE into downstream models and never built on its own.

How do you test data in dbt?

Generic tests in YAML, such as unique, not_null, accepted_values and relationships, cover most needs. Singular tests are SQL files returning failing rows. Source freshness checks catch stale data. Run them all with dbt build, ideally in CI on every pull request.

What can go wrong with incremental models?

Late-arriving or updated records can be missed if you only load rows newer than the latest timestamp. Fix it with a lookback window, a unique_key with merge, and a periodic full refresh. Always test the incremental result matches a full build.

What is a semantic layer?

A single place where metrics like revenue or active users are defined once, with their logic and dimensions, so every tool and person gets the same answer. It reduces conflicting numbers and makes self-service and AI assistants trustworthy.

Warehouses and Snowflake

What does separating storage and compute mean in Snowflake?

Data is stored once in cloud storage, while independent virtual warehouses provide compute. Teams can query the same data without slowing each other down, and you only pay for compute while a warehouse is running.

How do micro-partitions and pruning speed up queries?

Snowflake stores tables in small, compressed micro-partitions with metadata such as the min and max of each column. Queries filtering on those columns skip partitions that can't match. Clustering keys improve pruning on very large tables.

What are Time Travel and zero-copy cloning?

Time Travel lets you query or restore data as it was in the past, within the retention period, and UNDROP dropped objects. Zero-copy cloning creates an instant, writable copy of a table, schema or database that shares storage until either copy changes.

Why is columnar storage fast for analytics?

Analytical queries usually read a few columns across many rows. Columnar storage reads only those columns and compresses similar values extremely well, so far less data is scanned.

How would you reduce warehouse costs?

Right-size warehouses and set short auto-suspend, avoid SELECT *, use incremental models, schedule heavy jobs sensibly, set resource monitors, and review the most expensive queries each month in the usage views.

What makes a pipeline idempotent and why does it matter?

Running it twice gives the same result as running it once, for example by using MERGE on a unique key or overwriting a partition instead of blindly appending. It makes retries and backfills safe.

Power BI and DAX

Calculated column versus measure in Power BI?

A calculated column is computed row by row when data refreshes and stored in the model, so it increases its size. A measure is calculated at query time in the current filter context. Prefer measures for aggregations; use columns for attributes you slice by.

Filter context versus row context?

Filter context is the set of filters applied to a calculation by visuals, slicers and CALCULATE. Row context exists when iterating over a table, such as in calculated columns or SUMX, giving access to the current row. Row context doesn't filter on its own.

What does CALCULATE do?

It evaluates an expression in a modified filter context: adding, replacing or removing filters. It's behind almost every advanced measure, such as year-over-year, percentage of total and time intelligence.

Why do star schemas matter in Power BI?

Filters flow cleanly from dimensions to facts, DAX stays simple, the VertiPaq engine compresses narrow fact tables well, and users see understandable tables. Flat wide tables and many-to-many relationships cause slow, confusing models.

Import mode versus DirectQuery?

Import loads data into Power BI's in-memory engine: very fast, but only as fresh as the last refresh. DirectQuery sends queries to the source live: always current, but slower and with some DAX limits. Composite models mix both.

What makes a good dashboard?

It answers specific questions for a specific audience, puts the key number top-left, shows comparisons with targets or past periods, uses colour to highlight rather than decorate, and says when the data was last refreshed.

Statistics and A/B testing

When would you use the median instead of the mean?

When data is skewed or has outliers, such as income or order values. A few huge orders pull the mean up, while the median shows the typical value. Report both when the gap between them is informative.

Explain a p-value in plain English.

If there were truly no effect, the p-value is the probability of seeing a result at least as extreme as the one observed. A small p-value means the data would be surprising under 'no effect'. It isn't the probability that the hypothesis is true.

How do you design a good A/B test?

Pick one primary metric up front, calculate the sample size from the minimum effect you care about, randomise properly, run for full weekly cycles, and don't stop early just because results look significant. Check for sample ratio mismatch before trusting results.

Correlation versus causation?

Correlation means two things move together; causation means one changes the other. Ice cream sales and sunburn correlate because of sunshine. Randomised experiments are the most reliable way to establish causation.

What is Simpson's paradox?

A trend that appears in every group can reverse when the groups are combined, because group sizes differ. Always check segment-level results, such as by device or country, before concluding from an overall average.

Type I versus Type II errors?

A Type I error is a false positive: declaring an effect that isn't real. A Type II error is a false negative: missing a real effect. The significance level controls Type I errors; statistical power, mainly through sample size, controls Type II.

Behavioural

How should you answer 'Tell me about yourself'?

Keep it to about two minutes: present (your current focus and strengths), past (one or two achievements that prove them, with numbers), and future (why this role is the natural next step). Tailor every part to the job description.

What is the STAR method?

Situation, Task, Action, Result. Briefly set the scene and your responsibility, spend most of the time on what you did, and finish with a measurable result and what you learned. Prepare five or six stories you can adapt to many questions.

Tell me about a disagreement with a stakeholder.

Choose a real, professional disagreement. Show that you listened, used data to find common ground, proposed options, and reached an outcome that served the business. End with the result and what you'd keep doing.

Tell me about a time your analysis was wrong.

Interviewers want ownership. Explain what happened, how you found the error, how quickly you told people, how you fixed it, and the safeguard you added, such as a test or a peer review, so it couldn't happen again.

How do you explain technical work to non-technical people?

Start with the decision or outcome, not the method. Use analogies and one clear chart, avoid jargon, and check understanding. Describe a specific time you did this and what changed as a result.

What questions should you ask the interviewer?

Ask about how success is measured in the first six months, the data stack and its biggest pain points, how the team handles data quality, who the main stakeholders are, and what the team is proudest of. Thoughtful questions show genuine interest.

Your 7-day game plan.

One focused hour a day is enough to walk in confident.

1

Know the role

Read the job description twice. List the tools and skills it mentions and match each to an example from your experience.

2

SQL drills

Joins, GROUP BY and window functions come up in almost every technical round.

Play the SQL puzzles
3

Python and pandas

Practise cleaning, grouping and merging data without looking things up.

Play the Python puzzles
4

Modelling and dbt

Be ready to sketch a star schema on a whiteboard and explain grain, tests and incremental models.

Read the star schema guide
5

BI and statistics

Revise DAX basics, dashboard design, A/B testing and when to use the median.

Read the DAX guide
6

Your STAR stories

Write five stories with numbers: a win, a mistake, a conflict, a deadline and a time you simplified something complex.

7

Mock interview

Run the quiz, answer the flashcards out loud, and prepare three thoughtful questions for the interviewer.

On the day

  • Test your camera, microphone and screen sharing 15 minutes early.
  • Have the job description, your CV and your STAR notes open.
  • Think out loud in technical rounds. Interviewers grade your reasoning, not just the answer.
  • Ask clarifying questions before writing any SQL: grain, NULLs, duplicates, time zone.
  • Check your result against a quick sanity test, such as row counts or totals.
  • Close with your questions, then send a short thank-you note the same day.