Back to blogTech hiring

SQL Test for Data Analysts: What to Test at Each Level (With Examples)

Ismayil IsmayilovIsmayil Ismayilov7 min read
SQL Test for Data Analysts: What to Test at Each Level (With Examples)

Almost every data analyst CV lists SQL. Far fewer candidates can write a correct query with a join, a group-by and a filter on the first try. The candidates who can't usually get through interviews by describing what they would do. A short SQL test shows what they can actually do, in 15–30 minutes.

What to test at each level

LevelMust be able toExample task
JuniorSELECT, WHERE, ORDER BY, basic aggregates (COUNT, SUM, AVG), GROUP BY, simple INNER JOIN"Total revenue per city for orders in 2025"
MidLEFT/INNER joins across 3+ tables, HAVING, CASE WHEN, subqueries or CTEs, date functions, NULL handling"Customers who ordered in Q1 but not in Q2"
SeniorWindow functions (ROW_NUMBER, LAG, running totals), query optimisation, data modelling judgement, data quality checks"Month-over-month retention by signup cohort"

Choose the level the role actually requires. A junior reporting analyst does not need window functions on day one.

Question formats

Multiple-choice on real queries. Show a query and a small table, then ask what it returns or which query answers a business question correctly. Fast, objective, and great for first-round screening.

Find the bug. Show a query that returns the wrong number, for example a LEFT JOIN that silently becomes an INNER JOIN because of a WHERE condition. Ask the candidate to spot the issue. This tests real-world understanding, not just syntax.

Write the query. The candidate writes SQL against a provided schema. This is the closest to real work and the best fit for shortlisted candidates.

Interpretation. "The query shows a 40% drop in active users in March. What would you check before reporting this?" This tests analytical judgement: is it a data issue, a definition change, or a real drop?

The mistakes that reveal the most

  • forgetting that COUNT(column) ignores NULLs
  • joins that multiply rows and inflate sums
  • filtering a LEFT JOIN in WHERE instead of in ON
  • confusing WHERE and HAVING
  • off-by-one date ranges (<= vs. < with timestamps)

A candidate who handles these correctly will produce numbers you can trust.

Combine SQL with data literacy and reasoning

Writing queries is only half the job. Analysts also need to read data critically and explain it. A strong assessment for a data analyst role combines:

  1. SQL fundamentals (15 min)
  2. Data literacy: reading charts, spotting misleading metrics (10 min)
  3. Critical thinking: drawing correct conclusions (10 min)
  4. One short essay or video question: "Explain your findings to a non-technical manager."

TheyTest's library includes entry-level SQL Fundamentals and Data Literacy tests in several languages, alongside Critical Thinking.

Scoring tips

  • Correctness first: a query that runs but returns the wrong number is worse than one with a syntax error, because it looks right.
  • Readability counts at mid and senior level: clear aliases, CTEs and formatting.
  • Set the bar per role. A threshold that suits a senior analyst will reject good juniors.

Preventing cheating on SQL tests

SQL questions are easy to paste into an AI assistant, so use:

  • questions randomised from a pool and shuffled answer options
  • time limits per test
  • full-screen mode with tab-switch and copy-paste detection
  • a session recording to review results that look suspiciously perfect

Build your SQL assessment

Use the SQL Fundamentals library test as a base, add 3–5 custom questions on your own schema and set the time limit. You can be screening candidates the same day.

Start a free trial

FAQ

How long should a SQL test take?

15–20 minutes for a junior screening test, and up to 45 minutes for a practical task with shortlisted mid or senior candidates.

Which SQL dialect should we test?

Test standard SQL for screening. Dialect differences (PostgreSQL, MySQL, SQL Server, Oracle) are easy to learn. Logic errors are not.

Should data analysts also take an Excel test?

For reporting-heavy roles, yes. Many analysts move data between SQL and spreadsheets every day.

Ismayil Ismayilov

About the author

Ismayil Ismayilov

Co-Founder & CTO, TheyTest

LinkedIn