Free · 10 questions · 5 minutes

SQL Quiz: Test Your SQL Skills

Answer 10 questions, from SELECT basics to window functions, and see your SQL level with every answer explained.

SELECT and WHERE

What does this query return?

SELECT DISTINCT city
FROM customers;

What this SQL quiz covers, sample questions with answers, and what your score means for data jobs.

What the SQL quiz covers

This SQL quiz has 10 questions across the five topics data analysts use most, ordered from basics to advanced. Half are multiple choice. The other half are “write the query” tasks: you get a table and a goal, then pick the query that returns the right result.

Topics in the SQL quiz
TopicWhat it checksLevelQuestions
SELECT and WHEREFiltering, sorting, and removing duplicatesBeginner2
JOINsLEFT vs. INNER joins and picking the right join keyBasic2
GROUP BY and aggregationsSUM, COUNT, and filtering groups with HAVINGBasic to intermediate2
SubqueriesNOT IN and comparing rows with an averageIntermediate2
Window functionsPARTITION BY and numbering rows with ROW_NUMBERAdvanced2

Every question uses two small tables, customers and orders, and standard SQL that works the same way in PostgreSQL, MySQL, SQL Server, and SQLite. When you finish, you’ll see your score, your level, a breakdown by topic, and an explanation for every answer, including the ones you got right.

Sample SQL quiz questions

Here are three practice questions in the same style as the quiz, with answers. They aren’t in the test itself, so trying them won’t spoil your score.

1. Why does this query fail in most databases?

SELECT amount * 0.9 AS discounted
FROM orders
WHERE discounted > 100;

Answer: WHERE runs before SELECT, so the alias discounted doesn’t exist yet when rows are filtered. Repeat the expression instead: WHERE amount * 0.9 > 100. The same order of steps (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY) is why ORDER BY can use an alias and WHERE can’t.

2. What’s the difference between COUNT(*) and COUNT(email)?

Answer: COUNT(*) counts every row. COUNT(email) counts only the rows where email isn’t NULL, so on a table with missing emails, the two numbers differ. That gap is a quick way to check how complete a column is.

3. Write the query: label each order “large” if the amount is 100 or more, and “small” if it’s less.

orders (order_id, customer_id, order_date, amount)

Answer: Use CASE, SQL’s version of if-then-else. It checks each condition in order and returns the first match, and ELSE covers every other row:

SELECT order_id, amount,
  CASE
    WHEN amount >= 100 THEN 'large'
    ELSE 'small'
  END AS order_size
FROM orders;

SQL skill levels for data jobs

SQL is one of the most used languages in tech: 59% of developers in Stack Overflow’s 2025 Developer Survey said they use it. For data analysts, it’s the everyday tool for pulling, cleaning, and summarizing data. Here’s what each quiz level lets you do on the job:

  1. Beginner (0–3 correct)

    You can read simple queries. The next skill is pulling a filtered list from one table, like this week’s orders over $100 or every customer in one state, which is often the first request an analyst gets.

  2. Basic (4–6 correct)

    You can combine tables and build simple summaries: orders per customer, revenue by product, sign-ups by week. That covers the recurring reports and one-off data pulls in many entry-level analyst jobs.

  3. Intermediate (7–8 correct)

    You can answer layered business questions, like which customers stopped buying or which products beat the average, and prepare clean tables for dashboards in Power BI or Tableau.

  4. Advanced (9–10 correct)

    You can build rankings, running totals, retention reports, and month-over-month changes in a single query. Window functions like these often come up in data analyst interviews.

Keep practicing

The quickest way to move up a level is to write queries against tables every day. If you scored in the beginner or basic range, start with TripleTen’s free SQL course: 20 hours of short lessons with coding practice, covering grouping and sorting, table joins, and subqueries and CTEs.

If you scored intermediate or advanced, SQL is ready to be part of a bigger skill set. The Data Analytics program adds Python, Power BI, and predictive analytics, and you’ll build a portfolio of projects for data analyst jobs.

FAQ

Is this SQL assessment used by employers?

No. It’s a practice quiz for checking your own skills, and your score isn’t shared with employers. Hiring teams usually run their own SQL assessment, often a timed test or a live query exercise. The topics overlap with this quiz: joins, aggregations, subqueries, and window functions.

How long does it take to learn SQL?

You can learn the basics, like SELECT, WHERE, ORDER BY, and simple joins, in a few weeks of regular practice. Getting comfortable with aggregations, subqueries, and window functions usually takes a few months of writing queries against business data. How often you practice matters more than how long each session is.

What’s a good score on the SQL quiz?

7 out of 10 or higher puts you at the intermediate level, which covers most day-to-day SQL work in entry-level analyst roles. A 9 or 10 means you’re comfortable with window functions, which often come up in analyst interviews. Whatever you score, the answer explanations show what to learn next.

Is the SQL quiz free?

Yes. The quiz is free and takes about 5 minutes. You’ll share your name, email, and phone number at the end to unlock your results.

Which SQL dialect does the quiz use?

Standard SQL. Every correct answer works the same way in PostgreSQL, MySQL, SQL Server, and SQLite, so you don’t need to know a specific database.

Take the SQL quiz