SQL Topic collection

SELECT Statements SQL Topic exercises

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

Exercises
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. Advanced guided labs state their engine boundary before you open the workspace.

  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
01

Attempt

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

02

Validate

Run it against the included dataset and inspect the output.

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.