Data Analyst Interview Prep: Questions and a Mock Test
The data analyst loop is the most SQL-heavy interview of any role covered here, and the SQL is chosen so that a query which looks right returns the wrong number. Beyond that, the assessment is about judgement: whether you check that a number is real before explaining it, whether you know what an experiment does and does not prove, and whether you can tell someone the answer in a way that changes what they do. This page covers those areas and ends with a graded mock across six of them.
How the process is structured
| Round | Length | What it tests |
|---|---|---|
| 1.SQL[1] | Not published | Live querying against a small schema, usually with a deliberate trap: NULL semantics, a join that fans out, or a requirement that needs a window function. Marked on correctness and on whether you validate assumptions before aggregating. |
| 2.Case study and metrics[2] | Not published | Defining success for a feature or explaining why a metric moved. Assessed on whether you confirm the change is real before explaining it, and on whether you decompose a rate rather than guessing at causes. |
| 3.Statistics and experiments[2] | Not published | Interpreting an A/B test correctly: what a p-value licenses, what a confidence interval adds, peeking, multiple comparisons, and sample ratio mismatch. The trustworthy-experiments literature is the reference body here. |
| 4.Communication and stakeholders[3] | Not published | Presenting a finding to someone non-technical, and handling a stakeholder who disputes it. Data quality comes up here too, framed the way dbt frames it: a test returns the rows that disprove your assertion, and passing means zero rows. |
Bracketed markers point to the dated sources at the end of this article. Loops change; check the retrieval dates before relying on a round count.
The SQL round, and the traps it is built from
Interviewers do not set hard SQL. They set SQL with a trap, and watch whether you notice.
NULL handling is the most common. NULL is the absence of a value, so any comparison with it yields unknown rather than true. A filter of the form status != 'cancelled' silently drops every row where status is NULL, and NOT IN against a subquery containing one NULL returns nothing at all. COUNT(column) skips NULLs while COUNT(*) does not, and an average over a column with NULLs divides by the number of non-null values, which is frequently not the denominator anyone intended.
Join fan-out is the second. Joining to a table where the key is not unique multiplies rows, so any SUM computed afterwards is inflated. Checking cardinality before aggregating is the habit being assessed, and saying so out loud is worth marks even when the data turns out to be clean.
The third is the difference between filtering in WHERE and filtering in the ON clause of an outer join. A predicate on the right-hand table placed in WHERE quietly converts a LEFT JOIN into an inner join, because the NULLs the join produced fail the test. This one appears in nearly every loop.
The fourth is the difference between WHERE and HAVING: WHERE filters rows before grouping, HAVING filters groups after. Using HAVING for a row-level condition works and scans more than it needs to; using WHERE for an aggregate condition is an error.
Window functions, and why they sit where they do
Window functions are the clearest dividing line between a junior and a mid-level analyst, and the PostgreSQL documentation defines them exactly: "a window function performs a calculation across a set of table rows that are somehow related to the current row".
The distinction from an aggregate is the part to be able to state. "Window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would. Instead, the rows retain their separate identities." That is why you can show each order alongside the customer's total without a self-join, and it is the reason window functions replace so much awkward SQL.
PARTITION BY defines the neighbourhood: it "divides the rows into groups, or partitions, that share the same values of the PARTITION BY expression(s)", and the function is computed across the rows in the current row's partition.
The evaluation order explains a rule that otherwise looks arbitrary. The rows a window function sees are those of the virtual table produced by FROM "as filtered by its WHERE, GROUP BY, and HAVING clauses". So window functions run after filtering, which is why they "are permitted only in the SELECT list and the ORDER BY clause" and are forbidden in WHERE, GROUP BY and HAVING. To filter on a window function's result, you compute it in a subquery or common table expression and filter in the outer query. That pattern, ranking inside and filtering outside, is the single most useful thing to have ready.
Know the three ranking functions apart: ROW_NUMBER breaks ties arbitrarily, RANK ties then skips, DENSE_RANK ties without skipping.
Metrics and funnels, defined precisely
The case round usually asks you to define a metric or explain a movement, and precision about definitions does most of the work.
A rate is a ratio, so it can move for three different reasons: the numerator changed, the denominator changed, or the mix underneath changed while every segment stayed flat. That third case reverses conclusions and is worth naming explicitly whenever a rate is discussed.
Funnels have their own traps. The denominator at each step should be stated, since step conversion and overall conversion are different numbers. The window matters, because a user who converts three days later either counts or does not depending on a choice somebody made. And ordering assumptions frequently do not hold, since real users skip steps, repeat them and arrive mid-funnel from a link.
Definitional drift is the recurring real-world problem. Two teams reporting different numbers for the same metric almost always differ on whether bots and internal traffic are excluded, whether the day boundary is UTC or local, whether anonymous identifiers count as users, and whether identity is stitched across devices. The professional response is to agree the definition once and encode it in one place rather than re-deriving it per query.
Data quality checks belong in the same conversation. The dbt framing generalises well: tests are select statements that "seek to grab failing records, ones that disprove your assertion", and "if the data test returns zero failing rows, it passes". Uniqueness, not-null, accepted values and referential integrity catch most of what silently corrupts a dashboard.
Reading an experiment without overclaiming
Analysts are asked to interpret experiments far more often than to design them, and the failure modes are consistent.
A p-value is the probability of data at least as extreme as yours, assuming the null hypothesis is true. It is not the probability that the null is true, and one minus the p-value is not the probability that the effect is real. This reversal is the most common statistical error in the field.
Peeking inflates false positives, because checking repeatedly gives the statistic many chances to cross a threshold that random fluctuation will eventually cross. Multiple comparisons do the same across metrics: at twenty metrics and a 0.05 threshold, one significant result is what chance alone produces. The defence is nominating the primary metric before looking.
A non-significant result is not evidence of no effect. The informative output is the confidence interval, which distinguishes a study that genuinely found nothing from one that could not have detected anything.
Sample ratio mismatch deserves specific attention because analysts are often the ones who notice it. If the split is meant to be even and is not, at realistic sample sizes that is not chance; something in assignment or logging is broken, and whatever caused it may also be selecting which users appear. Reweighting patches the symptom and leaves the selection bias in place, so the correct response is to treat the result as untrustworthy until the cause is explained.
And the general principle: an observational difference between users who did and did not do something is a comparison between kinds of people, not an effect.
The part that decides whether the analysis mattered
The last round is usually communication, and it is not a soft skill in this context. An analysis that nobody acts on has failed regardless of its correctness.
Start from the decision. Knowing who will act on the number, and what they would do differently at different values, determines the whole shape of the output, and an analysis that changes nobody's behaviour at any plausible value is a report rather than a finding.
Lead with the answer. Analysts frequently narrate their method and arrive at the conclusion last, which is the reverse of what a decision-maker needs. Conclusion, then the evidence, then the caveats, then the method for anyone who wants it.
Be explicit about uncertainty without hiding behind it. Saying that a difference is within normal weekly variation is useful; refusing to give a view because the data is imperfect is not. Stating the confidence interval, or the range of plausible values, gives someone what they need to act proportionately.
The question that comes up in most loops is what you do when a stakeholder does not like the answer. The professional response separates the facts from the interpretation: if they have information that changes the analysis, incorporate it gladly; if they simply prefer a different conclusion, document the finding and let the decision be theirs. Quietly adjusting an analysis to fit a preferred conclusion is the one failure that ends an analyst's credibility permanently, and interviewers ask about it for exactly that reason.
What they actually ask
1.Weekly active users fell 12 percent. You have an hour. What do you do?
What a strong answer coversVerify before explaining. Is the drop real or an artefact: a tracking or SDK change, a bot filter that started or stopped, a definitional change nobody announced, a pipeline that partially failed. Is it outside normal variation, compared against the same week historically rather than against last week alone. Then decompose along the dimensions most likely to isolate it: platform, app version, geography, new versus returning, acquisition channel. Concentration in one platform and version points at a release; an even spread across everything points at measurement or an external event. Strong candidates state explicitly what they will report if the hour runs out, which is the honest scope of what is known rather than a guess presented as a finding.
2.How would you define a good metric for a subscription product's health?
What a strong answer coversExpected structure: what decision the metric informs, then a primary measure, then guardrails. Strong answers avoid vanity measures such as total registered accounts, and reach for something that reflects sustained value, retained subscribers or revenue retention, with the cohort structure made explicit since a blended number hides whether new cohorts are worse than old ones. They distinguish leading indicators available in days from lagging ones like renewal that take months. They name how the metric could be gamed, for example by making cancellation hard, and pair it with a guardrail such as complaint or refund rate. The strongest close is stating what value would prompt a different decision.
3.A stakeholder asks you to remove a segment from the analysis because it makes the result look bad. How do you respond?
What a strong answer coversThe distinction to draw is between a legitimate analytical reason and a preferred conclusion. If the segment is genuinely not comparable, internal test accounts, a market with a different product, a period affected by an outage, excluding it is correct and should be documented as an exclusion with its rationale. If the only reason is that the number is unwelcome, the answer is no, delivered without moralising: present both the full result and the segmented breakdown so the stakeholder can see what drives it, and let them make the decision with the facts. Strong candidates say plainly that quietly reshaping an analysis to fit a desired conclusion destroys the credibility that makes the role worth having.
4.Two teams report different numbers for the same metric. How do you resolve it?
What a strong answer coversAssume a definitional difference rather than an error, because that is nearly always what it is. The usual suspects: bot and internal traffic filtering, the timezone used for the day boundary, whether anonymous or logged-out users count, whether identity is stitched across devices, the date field used, event versus session grain, and late-arriving data changing a previously-reported figure. Strong answers work by reconciling on a single small slice rather than debating totals, since one day and one segment localises the difference quickly. The durable fix is agreeing a definition once and encoding it in one shared model that both teams query, rather than each team re-deriving it.
5.You are asked whether a marketing campaign caused the increase in signups. What do you say?
What a strong answer coversThe strong answer resists the causal claim while still being useful. A before-and-after comparison confounds the campaign with seasonality, other launches and anything else that changed. Better evidence, in ascending order: a comparison against a region or segment not exposed, a difference-in-differences using that comparison group with pre-period trends checked for parallelism, and best of all a holdout that was randomised in advance. Strong candidates note what would have made this answerable, namely holding out a random fraction from the campaign, and recommend doing so next time. They also separate incrementality from attribution, since a channel can be credited with signups that would have happened anyway.
6.How do you know a dashboard is still correct six months after you built it?
What a strong answer coversThe expected recognition is that dashboards rot silently, and nobody reports a number that is quietly wrong. Strong answers add automated checks rather than relying on someone noticing: row counts and freshness, uniqueness on keys, not-null on required fields, accepted values on enumerations, referential integrity, and volume checks that catch a source halving. The dbt framing is useful, a test is a query that returns the rows disproving an assertion and passes when it returns none. They also cover the human side: an owner, a documented definition, alerting that goes somewhere a person actually reads, and periodic reconciliation against an independent source such as finance for revenue figures.
Three sample questions, answered
These three show the level the mock is pitched at, with the answer and the reasoning in the open. The graded paper keeps its answer key server-side.
- Because it would create a circular reference with the FROM clause
- Because WHERE only accepts scalar expressions
- Because window functions logically execute after WHERE, GROUP BY and HAVING have been processed
- Because window functions require an index on the partitioning column
Why: The documentation states that window functions "are permitted only in the SELECT list and the ORDER BY clause" and are forbidden in GROUP BY, HAVING and WHERE, "because they logically execute after the processing of those clauses". To filter on one, compute it in a subquery or CTE and filter in the outer query.
- 500
- 700
- 800
- 1000
Why: Comparing anything with NULL yields unknown rather than true, so the 200 NULL rows fail the predicate along with the 300 closed rows, leaving 500. Including them requires an explicit OR status IS NULL. This silent row loss is one of the most common real defects in production SQL and appears in most analyst loops.
- The conversion event stopped firing for some users
- Fewer users entered the funnel, but those who did converted at a higher rate
- The reporting window was shortened
- Average order value increased
Why: A rate can rise purely because its denominator shrank. Changes that filter out less committed users earlier improve the rate while reducing the absolute outcome, which is why a mid-funnel rate makes a poor headline metric. Counting the outcome per user entering the funnel avoids the trap.
An 18-question knowledge check
This is a knowledge check, not a simulation. The real loop happens on a whiteboard, in an editor, and in conversation. What this paper does measure is the underlying knowledge those rounds draw on: each question is tagged with a topic, grading happens per topic, and a weak topic points you at the course that fixes it.
- 1.You LEFT JOIN customers to orders and add WHERE orders.total > 100. What is the effect?SQL joins and semantics
- 2.What is the difference between WHERE and HAVING?SQL joins and semantics
- 3.An inner join between orders and customer_addresses returns more rows than orders had. Why?SQL joins and semantics
- 4.What distinguishes a window function from an aggregate function?Window functions and ranking
- 5.Which ranking function produces 1, 2, 2, 3 for four rows where the second and third tie?Window functions and ranking
- 6.What does PARTITION BY do inside an OVER clause?Window functions and ranking
- 7.Two teams report different daily active user counts. What is the most likely cause?Metric and funnel definition
- 8.Which is the strongest test of whether a metric is worth tracking?Metric and funnel definition
- 9.A funnel report shows step conversion of 80, 70 and 60 percent. What is overall conversion?Metric and funnel definition
- 10.An A/B test returns p = 0.03. Which statement is correct?Reading experiments honestly
- 11.The control group received 51.5 percent of a supposedly even split. What is the correct response?Reading experiments honestly
- 12.A test shows no significant difference. What follows?Reading experiments honestly
- 13.Users of a feature retain 40 percent better than non-users. What can you conclude?Statistical reasoning
- 14.A team of 20 people has a mean salary of 60,000 and a median of 45,000. What does that indicate?Statistical reasoning
- 15.A metric that was unusually high last month is closer to average this month, with no intervention. What is the most parsimonious explanation?Statistical reasoning
- 16.You have five minutes with an executive to present an analysis. What comes first?Communicating findings
- 17.How should you present a result whose confidence interval spans a small negative and a meaningful positive effect?Communicating findings
- 18.What is the value of framing a data quality test as a query returning failing rows?Communicating findings
Sources
Hiring loops change. Every claim above carries a retrieval date so you can judge how current it is.
- [1]PostgreSQL Documentation, Window Functions · retrieved 2026-08-13
- [2]Kohavi, Tang and Xu, Trustworthy Online Controlled Experiments, and the experimentation paper archive · retrieved 2026-08-13
- [3]dbt Labs, Add data tests to your DAG · retrieved 2026-08-13
Refresh your memory
Free learning paths covering the ground this loop tests, whatever your score. Each one ends with a shareable certificate.
- BusinessFrom Spreadsheet to Insight: Analysis Without a Data Background
Analytical errors in business rarely look like errors. They look like answers. This cursus builds the habits that catch them: restating a vague question as something measurable, finding out what your data was actually collected for, and looking at it before summarising it. Then the technical layer, which is small: tidy data, pivot tables, and joins that silently drop or duplicate rows. It ends on the five analytical patterns that answer most business questions, and what you may honestly conclude from each.
3 lessons - BusinessData Storytelling: Turning Numbers Into a Decision
Most data presentations fail before a chart is drawn, because they are organised around what the analyst found rather than what the audience must decide. This cursus starts from the decision, inverts the delivery order, and puts one message in every exhibit. Then charts: why chart choice follows from the comparison, which encodings people read accurately, and how averages hide the finding. It ends in the room, on socialising findings, handling challenge, delivering unwelcome results, and where persuasion becomes manipulation.
3 lessons - BusinessHow to know what actually works
You changed something and the numbers moved, but did your change cause it? Answering honestly is harder than it looks, and getting it wrong wastes fortunes on things that never worked. Learn why before-and-after comparisons fool you, how a randomized experiment reconstructs the missing counterfactual, the statistical traps that make even a clean test lie, and why experiments quietly break on the social and marketplace platforms where they matter most.
3 lessons - BusinessA/B Testing at Scale: The Experimentation Platform
The companies that test everything do it because their own data showed most confident product ideas fail. This path builds the experimentation machine: randomisation and the plumbing that keeps it honest, the sample ratio check that catches broken experiments, the peeking trap and the sequential designs that fix it, and the advanced layer, CUPED variance reduction and the interference problems where arms contaminate each other.
4 lessons - MathProbability and Statistics for Machine Learning
Build the mathematical foundation every ML practitioner needs: go from sample spaces and distributions to Bayesian inference and hypothesis testing. By the end you will be able to choose the right distribution for any modelling problem, derive maximum likelihood estimators, reason about uncertainty the Bayesian way, and correctly interpret p-values and confidence intervals.
4 lessons

