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.
The tables
- pets (id, name, species, breed, age, weight_kg, adopted, arrived_on)
- adoption_requests (id, pet_name, email, phone, requested_on, budget)
- 1
Show every column for every pet in the
petstable.From the lesson Your first SELECT · Paws & Whiskers Shelter
Write your query here…Show the answerHide the answer
Answer (PostgreSQL and SQLite)
SELECT * FROM pets;Expected result (SQLite): first 8 of 20 rows
id name species breed age weight_kg adopted arrived_on 1 Biscuit dog Beagle 3 11.2 0 2026-01-14 2 Mochi cat Siamese 2 4.1 1 2025-11-02 3 Pickles dog NULL 7 24.5 0 2025-09-21 4 Luna cat NULL 5 3.8 0 2026-02-03 5 Waffles rabbit Holland Lop 1 1.6 1 2026-03-11 6 Bruno dog Boxer 9 30.1 0 2025-06-30 7 Pepper cat Bengal 1 3.2 1 2026-04-19 8 Noodle dog Dachshund 4 8.9 1 2025-12-08 - 2
List just the name and species of every pet.
From the lesson Your first SELECT · Paws & Whiskers Shelter
SELECT ___ FROM pets;
Show the answerHide the answer
Answer (PostgreSQL and SQLite)
SELECT name, species FROM pets;Expected result (both engines): first 8 of 20 rows
name species Biscuit dog Mochi cat Pickles dog Luna cat Waffles rabbit Bruno dog Pepper cat Noodle dog - 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 answerHide the answer
Answer (PostgreSQL and SQLite)
SELECT name, age, weight_kg FROM pets;Expected result (both engines): first 8 of 20 rows
name age weight_kg Biscuit 3 11.2 Mochi 2 4.1 Pickles 7 24.5 Luna 5 3.8 Waffles 1 1.6 Bruno 9 30.1 Pepper 1 3.2 Noodle 4 8.9 - 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 answerHide the answer
Answer (PostgreSQL and SQLite)
SELECT name, age + 1 FROM pets;Expected result (SQLite): first 8 of 20 rows
name age + 1 Biscuit 4 Mochi 3 Pickles 8 Luna 6 Waffles 2 Bruno 10 Pepper 2 Noodle 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 answerHide the answer
Answer (PostgreSQL and SQLite)
SELECT name, age * 12 AS age_months FROM pets;Expected result (both engines): first 8 of 20 rows
name age_months Biscuit 36 Mochi 24 Pickles 84 Luna 60 Waffles 12 Bruno 108 Pepper 12 Noodle 48 - 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 answerHide 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
name weight_g Ziggy 100 Kiwi 100 - 7
List every species, without repeats.
From the lesson Shape your results · Paws & Whiskers Shelter
Write your query here…Show the answerHide 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.
- Your first SELECT2 more exercises · free, no account needed
- Shape your results2 more exercises · free, no account needed
More practice sets
Check your level
The free SQL test takes about 10 minutes and tells you which lesson to start with.