Skip to main content

Solved SQL exercises and interview questions

Published on November 25, 2026 · Updated on November 28, 2026

A bank of solved SQL exercises to practice in the browser with instant grading. Each lesson answers a specific search, such as "GROUP BY exercises in SQL" or "second highest salary in SQL". First you review the concept with a query you run on the spot. Then you solve exercises of increasing difficulty, each with three graduated hints and an explanation of the solution. Everything uses the same PostgreSQL database of an online store and its team of employees, and each lesson introduces the tables it uses, so you can start with any lesson. The last module solves the most common technical interview questions: second highest salary, duplicates, customers without orders, top 3 per group, running total, and WHERE versus HAVING. It ends with a review of theory questions.

lessons
16
modules
5
of content
7 h 13 min

A sample lesson

sql
SELECT producto_id, nombre, precio
FROM productos
WHERE categoria = 'Electrónica'
ORDER BY producto_id;

Available in: EN · ES

By the end, you'll be able to

  • Write queries with SELECT, WHERE, ORDER BY, LIKE, IN, BETWEEN, and IS NULL that return exactly the requested rows.
  • Summarize data with COUNT, SUM, AVG, GROUP BY, and HAVING, and decide when to filter rows with WHERE and when to filter groups with HAVING.
  • Combine tables with INNER JOIN and LEFT JOIN without losing or multiplying rows, including unmatched ones.
  • Use subqueries and NOT EXISTS to solve questions such as customers without orders or employees above their department's average.
  • Use window functions to answer the second highest salary, the top 3 per group, and the running total, including when there are ties.

Course content

16
15 interactive lessons1 quiz

Worth knowing first

Courses and skills worth covering first to get the most out of this one (a suggestion, not a requirement).

Related skills

Skills from the map that this course helps you build.

Prepares you for

Mastering this course brings you closer to these skills.

Advances these routes

This course is part of broader learning paths.

Frequently asked questions

How long is Solved SQL exercises and interview questions?

16 lessons and about 7 h 13 min of content. You go at your own pace, with no fixed dates.

What will you learn in Solved SQL exercises and interview questions?

By the end you will be able to: Write queries with SELECT, WHERE, ORDER BY, LIKE, IN, BETWEEN, and IS NULL that return exactly the requested rows; Summarize data with COUNT, SUM, AVG, GROUP BY, and HAVING, and decide when to filter rows with WHERE and when to filter groups with HAVING; Combine tables with INNER JOIN and LEFT JOIN without losing or multiplying rows, including unmatched ones.

Similar content

Other courses, projects and specializations related to this content.

Course · Beginner · 7 h · Available in Spanish, English:

SQL for data analysis

Write SELECT queries with filters, sorting and limits to answer a specific question

Free
15% off

Project · Intermediate · 7 h · Available in Spanish, English:

Sales analysis with SQL and Python

Turn a business opinion into a question with an explicit metric, comparison period and grain

COP 16,915COP 19,900

Course · Intermediate · 8 h · Available in Spanish, English:

Analytical SQL: CTEs and window functions

Structure long queries as chained CTEs that read top to bottom and can be verified step by step

COP 49,900

Project · Intermediate · 6 h · Available in Spanish, English:

Project: a bike-sharing operations dashboard with SQL

Translate an operations team's questions into metrics with an explicit grain, definition and source

Free