SQL Topic collection

SELECT Statements SQL Topic exercises

Select columns, filter rows, remove duplicates, and order query results.

Published pages
23
Runnable now
12
Difficulty
Beginner

What this collection tests

Skills and query patterns

SELECT, aliases, DISTINCT, filtering, and ordering

Curated exercises

Choose an exercise

Work in the live editor where supported. Read-only solution guides and advanced guided labs state their capability before you choose the next action.

  1. Exercise 1Easy

    Basic SELECT - All Columns

    Return every column from the employees table.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  2. Exercise 2Easy

    SELECT Specific Columns

    Return first_name, last_name, and salary from employees.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  3. Exercise 3Easy

    SELECT DISTINCT

    Return distinct department IDs from employees.

    • Distinct values

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  4. Exercise 4Easy

    SELECT with Column Aliases

    Return first_name and last_name using friendly aliases.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  5. Exercise 5Easy

    SELECT with Expressions

    Return employee names with bonus calculated as salary * 0.10.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  6. Exercise 6Easy

    Reorder the Projected Columns

    Return salary, last_name, and first_name in that exact left-to-right order.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  7. Exercise 7Medium

    DISTINCT on Multiple Columns

    Return every unique department_id and job_id combination.

    • Sorting
    • Distinct values

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  8. Exercise 8Easy

    Use a Table Alias

    Alias employees as e and return e.first_name with e.salary.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  9. Exercise 9Easy

    Add a Constant Literal Column

    Return first_name with a constant record_type value of Employee.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  10. Exercise 10Medium

    Calculate Monthly Salary

    Return each employee’s annual salary and calculated monthly salary.

    • Numeric functions

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  11. Exercise 11Easy

    SELECT Without FROM

    Return 1 + 1 as result.

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  12. Exercise 12Hard

    Capstone — Compose a Projection

    Build the employee compensation projection required by the downstream export.

    • Numeric functions

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open exercise →
  13. Exercise 13Easy

    SELECT with WHERE Clause

    Return employees who earn more than $80,000.

    • Filtering

    Read-only solution guide

    Read solution guide →
  14. Exercise 14Easy

    SELECT with ORDER BY

    Return employees ordered by salary descending.

    • Sorting

    Read-only solution guide

    Read solution guide →
  15. Exercise 15Easy

    SELECT with LIMIT

    Return the top 3 highest-paid employees.

    • Sorting
    • Top-N

    Read-only solution guide

    Read solution guide →
  16. Exercise 16Easy

    SELECT with String Functions

    Return employee first and last names in uppercase format.

    • String functions

    Read-only solution guide

    Read solution guide →
  17. Exercise 17Easy

    SELECT with Multiple Conditions

    Return employees in department 10 with salary between 60000 and 90000.

    • Filtering

    Read-only solution guide

    Read solution guide →
  18. Exercise 18Easy

    SELECT with LIKE Pattern

    Return employees whose first name starts with J or G.

    • Filtering

    Read-only solution guide

    Read solution guide →
  19. Exercise 19Easy

    SELECT with IN Operator

    Return employees in departments 10, 20, or 30.

    • Filtering

    Read-only solution guide

    Read solution guide →
  20. Exercise 20Easy

    SELECT with NULL Handling

    Return employees who do not have a manager.

    • NULL handling
    • Filtering

    Read-only solution guide

    Read solution guide →
  21. Exercise 21Medium

    SELECT with CASE Statement

    Classify each employee as High, Medium, or Low salary based on salary level.

    • CASE expressions

    Read-only solution guide

    Read solution guide →
  22. Exercise 22Medium

    SELECT with String Concatenation

    Return full_name and email for each employee.

    • Sorting

    Read-only solution guide

    Read solution guide →
  23. Exercise 23Medium

    Boolean Expression in SELECT

    Return first_name, salary, and is_senior as 1 when salary is above 80000, otherwise 0.

    • CASE expressions

    Read-only solution guide

    Read solution guide →
01

Attempt

Write a query or design from the brief before opening any hints.

02

Validate

Run active exercises; use the published evidence and declared validation standard for read-only or guided pages.

03

Explain

Compare the verified answer and explain each choice aloud.

Learn before practicing SELECT Statements

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Practice Online →

Open the interactive workspace and practice across SQL topics.