SQL SELECT practice: 7 exercises with answers

Updated · Tested on PostgreSQL 18.6 and SQLite 3.54.1 (results generated , re-checked on every release)

Seven warm-up exercises on reading a table: picking columns, calculating values, naming them with AS and removing duplicates with DISTINCT. They run on the Paws & Whiskers shelter's pets table.

Write each query, press Check answer and get told right away whether your result matches. Stuck? Take a hint, or open the answer. New to the topic? Read the The SQL SELECT statement guide first.

Answers are checked on the engine you pick.
The tables

Paws & Whiskers Shelter

  • pets (id, name, species, breed, age, weight_kg, adopted, arrived_on)
  • adoption_requests (id, pet_name, email, phone, requested_on, budget)
  1. 1

    Show every column for every pet in the pets table.

    From the lesson Your first SELECT · Paws & Whiskers Shelter

    Write your query here…
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT * FROM pets;

    Expected result (SQLite): first 8 of 20 rows

    idnamespeciesbreedageweight_kgadoptedarrived_on
    1BiscuitdogBeagle311.202026-01-14
    2MochicatSiamese24.112025-11-02
    3PicklesdogNULL724.502025-09-21
    4LunacatNULL53.802026-02-03
    5WafflesrabbitHolland Lop11.612026-03-11
    6BrunodogBoxer930.102025-06-30
    7PeppercatBengal13.212026-04-19
    8NoodledogDachshund48.912025-12-08
  2. 2

    List just the name and species of every pet.

    From the lesson Your first SELECT · Paws & Whiskers Shelter

    SELECT ___ FROM pets;
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT name, species FROM pets;

    Expected result (both engines): first 8 of 20 rows

    namespecies
    Biscuitdog
    Mochicat
    Picklesdog
    Lunacat
    Wafflesrabbit
    Brunodog
    Peppercat
    Noodledog
  3. 3

    Show each pet's name, age and weight_kg, in that order.

    From the lesson Your first SELECT · Paws & Whiskers Shelter

    Write your query here…
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT name, age, weight_kg FROM pets;

    Expected result (both engines): first 8 of 20 rows

    nameageweight_kg
    Biscuit311.2
    Mochi24.1
    Pickles724.5
    Luna53.8
    Waffles11.6
    Bruno930.1
    Pepper13.2
    Noodle48.9
  4. 4

    Show each pet's name and the age it will be next year (its age plus 1).

    From the lesson Shape your results · Paws & Whiskers Shelter

    Write your query here…
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT name, age + 1 FROM pets;

    Expected result (SQLite): first 8 of 20 rows

    nameage + 1
    Biscuit4
    Mochi3
    Pickles8
    Luna6
    Waffles2
    Bruno10
    Pepper2
    Noodle5
  5. 5

    Show each pet's name and its age in months, in a column called age_months.

    From the lesson Shape your results · Paws & Whiskers Shelter

    Write your query here…
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT name, age * 12 AS age_months FROM pets;

    Expected result (both engines): first 8 of 20 rows

    nameage_months
    Biscuit36
    Mochi24
    Pickles84
    Luna60
    Waffles12
    Bruno108
    Pepper12
    Noodle48
  6. 6

    For birds only, show name and weight in grams as weight_g.

    From the lesson Shape your results · Paws & Whiskers Shelter

    Write your query here…
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT name, weight_kg * 1000 AS weight_g FROM pets WHERE species = 'bird';

    Expected result (both engines): 2 rows

    nameweight_g
    Ziggy100
    Kiwi100
  7. 7

    List every species, without repeats.

    From the lesson Shape your results · Paws & Whiskers Shelter

    Write your query here…
    Show the answer

    Answer (PostgreSQL and SQLite)

    SELECT DISTINCT species FROM pets;

    Expected result (SQLite): 4 rows

    species
    dog
    cat
    rabbit
    bird

The lessons have more like these

Each lesson teaches the idea step by step first, then gives you exercises with instant feedback and a daily streak.

More practice sets

Check your level

The free SQL test takes about 10 minutes and tells you which lesson to start with.