Skip to content
Questions by role

Data Analyst Interview Questions (With SQL Practice Questions and Answers)

Data analyst interview questions with sample answers, plus 8 SQL practice questions on a small dataset, each with a model query and its exact result.

By 10 min read
Shaker Abady

Written by

Shaker Abady

Founder, Provitude

I've sat on both sides of the hiring table — years as an employee working in SEO and software development, then as a business owner hiring people myself. Provitude is what I wished existed on both sides.

LinkedIn

Last updated · November 2026

Data analyst interview questions check three things: can you get the right numbers out of messy data, do you check them before anyone else sees them, and can you explain what they mean to someone who'll make a decision? Expect a SQL test (live or take-home), technical questions about statistics and data cleaning, a case question ("Sales fell last month. Why?") and behavioural questions about times your analysis mattered.

Below: what interviewers score, 8 SQL practice questions of rising difficulty on a small sample dataset (each with a model query and the exact result it returns), then technical, case and behavioural questions with sample answers, and a prep plan.

What interviewers are scoring

SkillWhat they listen forRed flag
SQL and data handlingCorrect joins, grouping and NULL handling, written readably.A query that runs but double-counts.
Checking your workYou sanity-check totals and row counts before sharing."The dashboard said so."
Business senseYou ask what decision the analysis is for.Analysis for its own sake.
CommunicationOne clear finding, in plain words, with the caveat.Twelve charts and no conclusion.
CuriosityYou ask "why?" a second and third time.Stopping at the first explanation.

SQL practice questions (with a sample dataset)

This page can't run code, so each question below shows the model query and the exact result it returns on this data. Try writing each one yourself first. The setup works as written in SQLite, and with little or no change in most other databases, if you want to run it.

The sample data

A small shop with five customers and eight orders. Amounts are in whole pounds. Two details are deliberate: one customer has no city, and one order has no status.

CREATE TABLE customers (
  customer_id INTEGER PRIMARY KEY,
  name        TEXT,
  city        TEXT
);
CREATE TABLE orders (
  order_id    INTEGER PRIMARY KEY,
  customer_id INTEGER,
  order_date  TEXT,
  amount      INTEGER,
  status      TEXT
);
INSERT INTO customers VALUES
  (1, 'Asha',  'London'),
  (2, 'Ben',   'Leeds'),
  (3, 'Chloe', 'London'),
  (4, 'Dev',   NULL),
  (5, 'Ella',  'Leeds');
INSERT INTO orders VALUES
  (101, 1, '2026-03-01', 40, 'paid'),
  (102, 1, '2026-03-09', 25, 'paid'),
  (103, 2, '2026-03-10', 60, 'refunded'),
  (104, 3, '2026-03-12', 15, 'paid'),
  (105, 3, '2026-04-02', 90, 'paid'),
  (106, 3, '2026-04-05', 30, NULL),
  (107, 5, '2026-04-07', 55, 'paid'),
  (108, 2, '2026-04-20', 20, 'paid');

1. Filtering: list paid orders over £30 placed in April 2026.

SELECT order_id, customer_id, amount
FROM orders
WHERE status = 'paid'
  AND amount > 30
  AND order_date >= '2026-04-01'
  AND order_date < '2026-05-01'
ORDER BY order_id;
order_idcustomer_idamount
105390
107555

Using >= the first day and < the first day of the next month is a habit worth showing: it still works when dates carry a time.

2. Aggregation: how many paid orders, total revenue and average order value?

SELECT COUNT(*) AS paid_orders,
       SUM(amount) AS revenue,
       ROUND(AVG(amount), 2) AS avg_order
FROM orders
WHERE status = 'paid';
paid_ordersrevenueavg_order
624540.83

Worth mentioning if you know it: in SQL Server, AVG of an integer column returns an integer, so you'd write AVG(amount * 1.0).

3. GROUP BY and HAVING: which customers have two or more paid orders?

SELECT customer_id,
       COUNT(*) AS paid_orders,
       SUM(amount) AS total_paid
FROM orders
WHERE status = 'paid'
GROUP BY customer_id
HAVING COUNT(*) >= 2
ORDER BY total_paid DESC;
customer_idpaid_orderstotal_paid
32105
1265

The follow-up is usually "What's the difference between WHERE and HAVING?" WHERE filters rows before grouping; HAVING filters groups after.

4. Joins: paid revenue by city.

SELECT c.city, SUM(o.amount) AS revenue
FROM orders AS o
JOIN customers AS c ON c.customer_id = o.customer_id
WHERE o.status = 'paid'
GROUP BY c.city
ORDER BY revenue DESC;
cityrevenue
London170
Leeds75

5. The join that duplicates rows: how many customers in each city have ordered?

A common first attempt:

SELECT c.city, COUNT(*) AS customers
FROM customers AS c
JOIN orders AS o ON o.customer_id = c.customer_id
GROUP BY c.city
ORDER BY c.city;
citycustomers
Leeds3
London5

Wrong. Joining to orders gives one row per order, so a customer with three orders is counted three times. Count distinct customers instead:

SELECT c.city, COUNT(DISTINCT c.customer_id) AS customers
FROM customers AS c
JOIN orders AS o ON o.customer_id = c.customer_id
GROUP BY c.city
ORDER BY c.city;
citycustomers
Leeds2
London2

Say out loud that you check row counts before and after every join. Interviewers love hearing it.

6. NULL handling: how many orders were not refunded?

SELECT COUNT(*) AS not_refunded
FROM orders
WHERE status <> 'refunded';

This returns 6, but the answer is 7. Order 106 has a NULL status, and NULL <> 'refunded' is unknown, not true, so the row is dropped. Handle the NULL explicitly:

SELECT COUNT(*) AS not_refunded
FROM orders
WHERE status IS NULL OR status <> 'refunded';
not_refunded
7

WHERE COALESCE(status, 'unknown') <> 'refunded' gives the same result.

7. LEFT JOIN: which customers have never ordered?

SELECT c.customer_id, c.name
FROM customers AS c
LEFT JOIN orders AS o ON o.customer_id = c.customer_id
WHERE o.order_id IS NULL;
customer_idname
4Dev

NOT EXISTS with a subquery returns the same row. Mention both.

8. Window functions: each customer's most recent order.

WITH ranked AS (
  SELECT customer_id, order_id, order_date,
         ROW_NUMBER() OVER (
           PARTITION BY customer_id
           ORDER BY order_date DESC
         ) AS rn
  FROM orders
)
SELECT customer_id, order_id, order_date
FROM ranked
WHERE rn = 1
ORDER BY customer_id;
customer_idorder_idorder_date
11022026-03-09
21082026-04-20
31062026-04-05
51072026-04-07

Likely follow-up: "What if a customer had two orders on the same day?" ROW_NUMBER picks one arbitrarily; add a tie-breaker such as order_id DESC, or use RANK if you want both.

Technical questions

9. "How do you clean a messy dataset?"

"I start by profiling it: row counts, NULLs per column, duplicates, and the range of each field, so I know what I'm dealing with. Then I fix things in a script, not by hand, so it's repeatable: standardise formats, remove true duplicates, and decide case by case what to do with missing values. I log every change, because someone will ask why the totals differ from the source."

10. "How do you check your numbers before you share them?"

"I reconcile against something I trust, such as finance's monthly revenue, and check that totals add up across breakdowns. I look at row counts before and after joins. And I ask whether the answer is plausible: if conversion has doubled overnight, it's probably tracking, not a miracle."

11. "When would you use the median instead of the mean?"

"When the data is skewed. A few very large orders pull the mean up, so the median describes a typical order better. If the two differ a lot, I report both and say why."

12. "Correlation or causation? Give an example."

"Customers who use our mobile app might spend more, but keen customers are more likely to install the app in the first place. To claim the app causes higher spending, I'd want an experiment, or at least a comparison of similar customers before and after they installed it."

13. "How would you tell whether an A/B test result is real?"

"First, check the set-up: random assignment, a sample size decided in advance, and a run long enough to cover a full weekly cycle. Then look at the size of the difference with a confidence interval, not just whether it's significant. And don't stop the test early because it looks good; checking repeatedly and stopping at the first good result inflates false positives."

14. "Which tools do you use, and for what?"

Be concrete: "SQL to pull and join data, Excel for quick checks and pivot tables, Power BI for the dashboards people use every week, and a bit of Python when a task repeats." If the job ad names a tool you haven't used, say what you've used that's similar and how you'd close the gap.

Case questions

15. "Sales dropped 15% last month. How would you investigate?"

Think out loud, in order. A worked answer:

"First, is the drop real? I'd check for a tracking change, a broken data feed or an incomplete month, and compare with the same month last year in case it's seasonal. If it's real, I'd split revenue into orders times average order value to see which one moved. Then I'd break the moving part down by channel, region, product and new versus returning customers, looking for where the drop is concentrated. Finally I'd check what changed that month: prices, a website release, marketing spend, stock problems. I'd come back with the main cause, how confident I am, and what I'd check next."

16. "How would you measure whether a new onboarding flow worked?"

"Agree one main metric first, such as the share of new users who complete a key action in their first week, plus guardrails like support tickets and 30-day retention. Ideally we'd A/B test it. If we can't, I'd compare before and after with care, because seasonality and marketing changes can easily look like a product effect."

Behavioural questions

Use STAR: Situation, Task, Action, Result. More in our guide to behavioral interview questions.

17. "Tell me about a time your analysis changed a decision."

"Marketing wanted to double spend on the channel with the most sign-ups. I tracked those sign-ups through to first purchase and found that channel had the lowest share of buyers. We moved part of the budget to the second channel instead, and cost per paying customer fell over the next quarter."

18. "Tell me about a mistake in your analysis."

"I once shared a churn figure that counted paused accounts as cancelled. A colleague in support spotted it. I corrected the report the same day, told everyone who'd seen it, and added a definitions tab so it couldn't happen quietly again."

19. "Tell me about a time someone disagreed with your numbers."

"A sales manager said my pipeline report was wrong. Instead of defending it, I sat with him and compared five deals line by line. We were both right: his team counted deals at first meeting, mine at proposal. We agreed one definition and put it on the dashboard."

20. "How do you explain a finding to people who don't work with data?"

"Lead with the answer and what it means for them, then one chart, then the caveat. 'Repeat customers fell by about a tenth this quarter, mostly in the north; I'd look at delivery times first.' The method is there if they ask."

Questions to ask them at the end

"Who are the main users of the team's analysis?", "How much time goes on ad-hoc requests versus planned work?" and "How do people here agree on metric definitions?" More ideas in questions to ask at the end of an interview.

How to prepare

  1. Do the eight SQL questions above on paper, then again without looking. Explain each one out loud as you would on a screen-share.
  2. Prepare four stories: an analysis that changed a decision, a mistake, a disagreement over numbers, and messy data you cleaned. Write them with the STAR story builder.
  3. Practise one case question out loud with a timer, talking through your structure before any numbers.
  4. Read the job ad for the tools and the business. The job description match tool shows where your experience lines up.
  5. Run a full mock interview a day or two before. (How to run one on your own in 30 minutes.)

Applying for something nearby? There are practice sets for reporting analysts, business analysts and data scientists, and if you're moving from project work, our project manager interview questions cover the stakeholder side.

Frequently asked questions

What SQL do I need for a data analyst interview?

Filtering, aggregation, GROUP BY with HAVING, inner and left joins, NULL handling, subqueries or CTEs, and at least one window function such as ROW_NUMBER. The eight questions above cover all of these.

Is the SQL test usually live or take-home?

It varies by employer. Ask the recruiter in advance; it's a normal question. For live tests, practise explaining while you type.

How do I answer data analyst questions with no experience?

Use projects: a public dataset you analysed, coursework, or reporting you did in another job. Show the question you asked, what you found, and what you'd recommend.

Do I need Python for a data analyst role?

Not always. Many analyst roles centre on SQL, spreadsheets and a dashboard tool. Check the job ad; if Python is listed, be ready to talk about one thing you've done with it.