Paws & Whiskers Shelter: a free sample database for SQL practice
Paws & Whiskers is the friendliest way to start with SQL: twenty animals with clear columns (species, breed, age, weight, adoption status), plus a table of raw adoption requests imported from a web form, complete with inconsistent text, empty strings and NULLs to clean up.
Tables and columns
Twenty animals waiting for a home, and the people who adopt them.
pets
20 rowsEvery animal that has come through the shelter.
- idinteger
- nametext
- speciestextdog, cat, rabbit or bird
- breedtextempty (NULL) for mixed breeds
- ageintegeryears
- weight_kgnumeric
- adoptedboolean
- arrived_ondate
adoption_requests
12 rowsRaw requests from the website form, imported as-is. Expect mess.
- idinteger
- pet_nametexttyped by visitors
- emailtext
- phonetextsometimes empty, sometimes NULL
- requested_ondate
- budgettextlike '$120', '80' or ''
What the data looks like
The first five rows of each table.
pets
| 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 |
adoption_requests
| id | pet_name | phone | requested_on | budget | |
|---|---|---|---|---|---|
| 1 | Biscuit | ana@mail.com | 555-0101 | 2026-10-01 | $120 |
| 2 | mochi | BEN@MAIL.COM | 2026-10-02 | 80 | |
| 3 | Biscuit | Ana@Mail.com | NULL | 2026-10-05 | $150 |
| 4 | Luna | cara@mail.com | 555-0104 | 2026-10-06 | NULL |
| 5 | PICKLES | dev@mail.com | 555-0105 | 2026-10-07 | $60 |
SQL practice questions for this database
Good for: First SELECT, WHERE and ORDER BY · NULL vs empty string · CASE WHEN labels · Data cleaning with TRIM, LOWER, NULLIF · Dates and strings. Try them yourself first, then compare.
Animals still waiting for a home, oldest firstShow a solution
SELECT name, species, age FROM pets WHERE adopted = false ORDER BY age DESC;
Result (PostgreSQL and SQLite, identical): first 8 of 12 rows
| name | species | age |
|---|---|---|
| Tofu | cat | 11 |
| Gizmo | dog | 10 |
| Bruno | dog | 9 |
| Socks | cat | 8 |
| Pickles | dog | 7 |
| Ziggy | bird | 6 |
| Luna | cat | 5 |
| Rocket | dog | 5 |
How many pets of each speciesShow a solution
SELECT species, COUNT(*) AS pets FROM pets GROUP BY species ORDER BY pets DESC;
Result (PostgreSQL and SQLite, identical): 4 rows
| species | pets |
|---|---|
| dog | 8 |
| cat | 7 |
| rabbit | 3 |
| bird | 2 |
Pets with no recorded breedShow a solution
SELECT name, species FROM pets WHERE breed IS NULL;
Result (PostgreSQL and SQLite, identical): 6 rows
| name | species |
|---|---|
| Pickles | dog |
| Luna | cat |
| Clover | rabbit |
| Tofu | cat |
| Bean | dog |
| Pumpkin | cat |
Label pets by age groupShow a solution
SELECT name, age,
CASE WHEN age < 2 THEN 'young'
WHEN age < 8 THEN 'adult'
ELSE 'senior' END AS age_group
FROM pets;Result (PostgreSQL and SQLite, identical): first 8 of 20 rows
| name | age | age_group |
|---|---|---|
| Biscuit | 3 | adult |
| Mochi | 2 | adult |
| Pickles | 7 | adult |
| Luna | 5 | adult |
| Waffles | 1 | young |
| Bruno | 9 | senior |
| Pepper | 1 | young |
| Noodle | 4 | adult |
The heaviest pet of each speciesShow a solution
SELECT species, name, weight_kg
FROM (SELECT species, name, weight_kg,
ROW_NUMBER() OVER (PARTITION BY species ORDER BY weight_kg DESC) AS rn
FROM pets) t
WHERE rn = 1
ORDER BY species;Result (PostgreSQL and SQLite, identical): 4 rows
| species | name | weight_kg |
|---|---|---|
| bird | Ziggy | 0.1 |
| cat | Socks | 7.4 |
| dog | Bruno | 30.1 |
| rabbit | Juniper | 3.4 |
Adoption rate per speciesShow a solution
SELECT species,
ROUND(100.0 * SUM(CASE WHEN adopted THEN 1 ELSE 0 END) / COUNT(*), 0) AS adopted_pct
FROM pets
GROUP BY species
ORDER BY species;Result (PostgreSQL and SQLite, identical): 4 rows
| species | adopted_pct |
|---|---|
| bird | 50 |
| cat | 43 |
| dog | 25 |
| rabbit | 67 |
Arrivals per monthShow a solution
SELECT SUBSTR(CAST(arrived_on AS TEXT), 1, 7) AS month, COUNT(*) AS arrivals FROM pets GROUP BY 1 ORDER BY 1;
Result (PostgreSQL and SQLite, identical): first 8 of 15 rows
| month | arrivals |
|---|---|
| 2025-04 | 1 |
| 2025-05 | 1 |
| 2025-06 | 1 |
| 2025-07 | 1 |
| 2025-08 | 1 |
| 2025-09 | 1 |
| 2025-10 | 2 |
| 2025-11 | 1 |
Names starting with BShow a solution
SELECT name, species FROM pets WHERE name LIKE 'B%' ORDER BY name;
Result (PostgreSQL and SQLite, identical): 3 rows
| name | species |
|---|---|
| Bean | dog |
| Biscuit | dog |
| Bruno | dog |
Requests with a usable phone numberShow a solution
SELECT COUNT(*) AS with_phone FROM adoption_requests WHERE NULLIF(TRIM(phone), '') IS NOT NULL;
Result (PostgreSQL and SQLite, identical): 1 row
| with_phone |
|---|
| 7 |
Clean the pet names in the requestsShow a solution
SELECT id, pet_name AS raw, LOWER(TRIM(pet_name)) AS cleaned FROM adoption_requests ORDER BY id;
Result (PostgreSQL and SQLite, identical): first 8 of 12 rows
| id | raw | cleaned |
|---|---|---|
| 1 | Biscuit | biscuit |
| 2 | mochi | mochi |
| 3 | Biscuit | biscuit |
| 4 | Luna | luna |
| 5 | PICKLES | pickles |
| 6 | luna | luna |
| 7 | Tofu | tofu |
| 8 | Pepper | pepper |
People who sent more than one requestShow a solution
SELECT LOWER(TRIM(email)) AS email, COUNT(*) AS requests FROM adoption_requests GROUP BY LOWER(TRIM(email)) HAVING COUNT(*) > 1 ORDER BY email;
Result (PostgreSQL and SQLite, identical): 4 rows
| requests | |
|---|---|
| ana@mail.com | 2 |
| ben@mail.com | 2 |
| cara@mail.com | 2 |
| gus@mail.com | 2 |
Average weight per species, one decimalShow a solution
SELECT species, ROUND(AVG(weight_kg), 1) AS avg_kg FROM pets GROUP BY species ORDER BY avg_kg DESC;
Result (PostgreSQL and SQLite, identical): 4 rows
| species | avg_kg |
|---|---|
| dog | 17.1 |
| cat | 4.6 |
| rabbit | 2.4 |
| bird | 0.1 |
How to load it
SQLite: sqlite3 animal-shelter.db < sqlstreak-animal-shelter-sample-database.sql
PostgreSQL: psql -d yourdb -f sqlstreak-animal-shelter-sample-database.sql
Or skip installing anything and query it in your browser.
Practise on this data every day
sqlstreak's lessons use these tables: five-minute exercises with instant feedback and a streak. No account needed to start.
Start the first lessonGuides that use it
- The SQL SELECT statement
- SQL WHERE clause: filtering rows
- NULL in SQL: IS NULL, COALESCE and the traps
- PostgreSQL vs SQLite: SQL syntax differences
- SQL ORDER BY, LIMIT and OFFSET
- SQL CASE WHEN
- SQL string functions
- SQL date functions in PostgreSQL and SQLite
- SQL self joins and CROSS JOIN
- SQL GROUP BY and HAVING
- SQL window functions
- Data cleaning in SQL
- SQL window frames, moving averages, NTILE and ROLLUP
- SQL INSERT, UPDATE and DELETE
- SQL CREATE TABLE, constraints and views
- SQL interview questions: the core patterns
Practice on it
- SQL SELECT practice: 7 exercises with answers
- SQL WHERE practice: 9 exercises with answers
- SQL ORDER BY and LIMIT practice: 7 exercises with answers
- SQL NULL practice: IS NULL, COALESCE and NULLIF exercises
- SQL text practice: LIKE patterns and string functions
- SQL GROUP BY and HAVING practice: 8 exercises with answers
- SQL window functions practice: 8 exercises with answers
- SQL date practice: 7 exercises in PostgreSQL and SQLite
- SQL data cleaning practice: 6 exercises with answers