The Work Gym / Free resources / Free practice datasets
SQL sample database: Kestrel online store
The database every lesson of the SQL course runs on: Kestrel, a fictional store for home and kitchen goods, in 17 related tables. Download it as one SQL script to practice in your own database, or open it in Excel, and follow the lessons that use each table.
Download
- online-store-sql.xlsxExcel workbook, one sheet per table (17) · 43 KB
- online-store-sql.sqlSQL script for PostgreSQL, MySQL, SQLite and DuckDB · 64 KB
CSV files, one per table
- products.csv20 rows · 836 B
- customers.csv24 rows · 2 KB
- orders.csv40 rows · 2 KB
- order_items.csv63 rows · 1 KB
- employees.csv14 rows · 932 B
- suppliers.csv8 rows · 448 B
- product_suppliers.csv22 rows · 330 B
- purchase_orders.csv26 rows · 1 KB
- tickets.csv64 rows · 6 KB
- events.csv326 rows · 14 KB
- stock_levels.csv350 rows · 6 KB
- memberships.csv40 rows · 1 KB
- campaigns.csv5 rows · 306 B
- campaign_touches.csv80 rows · 2 KB
- product_prices.csv29 rows · 719 B
- signups_raw.csv28 rows · 2 KB
- order_export.csv20 rows · 2 KB
The data is fictional and free to use for practice, teaching and portfolio work. A link back is appreciated.
What to practice
Kestrel sells home and kitchen goods online. The tables are small enough to read but hold the cases real data has: customers with no orders, products with two suppliers, NULLs, duplicates, messy raw exports and a manager hierarchy.
- Join
orders,order_itemsandproductsto find revenue by category. - Use a
LEFT JOINfromcustomerstoordersto find customers who never ordered. - Join
employeesto itself onmanager_idto list each person's manager. - Clean
signups_raw: trim names, fix emails and turnage_textinto numbers.
Practice with checked exercises
Data dictionary
Table and column names are exactly as they appear in the files.
products20 rows
Everything the store sells.
- product_idINTEGER
- Product number
- nameVARCHAR
- Product name
- categoryVARCHAR
- Category
- priceDECIMAL(8,2)
- Current selling price
- costDECIMAL(8,2)
- What one unit costs the store
- units_in_stockINTEGER
- Units in stock
First rows
| product_id | name | category | price | cost | units_in_stock |
|---|---|---|---|---|---|
| 1 | Stoneware Mug | Kitchen | 14 | 5.2 | 120 |
| 2 | Cast Iron Skillet | Kitchen | 42.5 | 18 | 35 |
| 3 | Bamboo Cutting Board | Kitchen | 24.99 | 9.1 | 64 |
| 4 | French Press | Kitchen | 32 | 12.75 | 0 |
| 5 | Linen Napkins (Set of 4) | Kitchen | 19.5 | 6.4 | 88 |
customers24 rows
People with an account. Some never ordered.
- customer_idINTEGER
- Customer number
- first_nameVARCHAR
- First name
- last_nameVARCHAR
- Last name
- emailVARCHAR
- Email address
- cityVARCHAR
- City
- countryVARCHAR
- Country
- signup_dateDATE
- Date they signed up
- loyalty_tierVARCHAR
- Loyalty tier
First rows
| customer_id | first_name | last_name | city | country | signup_date | loyalty_tier | |
|---|---|---|---|---|---|---|---|
| 1 | Amara | Okafor | [email protected] | Chicago | USA | 2023-02-14 | Gold |
| 2 | Luis | Ortega | [email protected] | Austin | USA | 2023-04-03 | Silver |
| 3 | Mei | Chen | [email protected] | Toronto | Canada | 2023-05-21 | Gold |
| 4 | Priya | Natarajan | [email protected] | London | UK | 2023-06-09 | Bronze |
| 5 | Jonas | Lindqvist | [email protected] | Toronto | Canada | 2023-07-30 |
orders40 rows
One row per order.
- order_idINTEGER
- Order number
- customer_idINTEGER
- Customer
- order_dateDATE
- Order date
- shipped_dateDATE
- Ship date (empty until it ships)
- statusVARCHAR
- Order status
- coupon_codeVARCHAR
- Coupon used, if any
- totalDECIMAL(10,2)
- Order total
First rows
| order_id | customer_id | order_date | shipped_date | status | coupon_code | total |
|---|---|---|---|---|---|---|
| 1001 | 1 | 2025-01-04 | 2025-01-05 | delivered | 92 | |
| 1002 | 3 | 2025-01-06 | 2025-01-08 | delivered | WELCOME10 | 89 |
| 1003 | 7 | 2025-01-09 | 2025-01-10 | delivered | 67.49 | |
| 1004 | 2 | 2025-01-12 | 2025-01-15 | returned | 129 | |
| 1005 | 12 | 2025-01-15 | 2025-01-17 | delivered | 68.75 |
order_items63 rows
The lines of each order.
- item_idINTEGER
- Line number
- order_idINTEGER
- Order
- product_idINTEGER
- Product
- quantityINTEGER
- Quantity
- unit_priceDECIMAL(8,2)
- Price paid per unit
First rows
| item_id | order_id | product_id | quantity | unit_price |
|---|---|---|---|---|
| 1 | 1001 | 1 | 4 | 14 |
| 2 | 1001 | 15 | 2 | 18 |
| 3 | 1002 | 9 | 1 | 89 |
| 4 | 1003 | 2 | 1 | 42.5 |
| 5 | 1003 | 3 | 1 | 24.99 |
employees14 rows
Staff, with a manager hierarchy.
- employee_idINTEGER
- Employee number
- first_nameVARCHAR
- First name
- last_nameVARCHAR
- Last name
- departmentVARCHAR
- Department
- job_titleVARCHAR
- Job title
- manager_idINTEGER
- Their manager's employee number (empty for the CEO)
- hire_dateDATE
- Hire date
- salaryINTEGER
- Annual salary
First rows
| employee_id | first_name | last_name | department | job_title | manager_id | hire_date | salary |
|---|---|---|---|---|---|---|---|
| 1 | Rosa | Delgado | Executive | Chief Executive | 2019-03-04 | 185000 | |
| 2 | Marcus | Webb | Engineering | Head of Engineering | 1 | 2019-08-19 | 162000 |
| 3 | Anjali | Rao | Engineering | Software Engineer | 2 | 2021-02-01 | 128000 |
| 4 | Ben | Carter | Engineering | Software Engineer | 2 | 2022-06-13 | 119000 |
| 5 | Lina | Park | Engineering | Data Analyst | 2 | 2023-01-09 | 98000 |
suppliers8 rows
Companies the store buys from.
- supplier_idINTEGER
- Supplier number
- nameVARCHAR
- Supplier name
- countryVARCHAR
- Country
- contact_emailVARCHAR
- Contact email
- ratingDECIMAL(2,1)
- Average review score out of 5 (empty if not rated)
First rows
| supplier_id | name | country | contact_email | rating |
|---|---|---|---|---|
| 1 | Northfield Ceramics | UK | [email protected] | 4.6 |
| 2 | Pinegate Textiles | Portugal | [email protected] | 4.2 |
| 3 | Ashby Metalworks | USA | 3.9 | |
| 4 | Saltmarsh Candles | Canada | [email protected] | 4.8 |
| 5 | Verdant Garden Supply | Netherlands | [email protected] |
product_suppliers22 rows
Which supplier makes which product.
- product_idINTEGER
- Product
- supplier_idINTEGER
- Supplier
- unit_costDECIMAL(8,2)
- Cost per unit from this supplier
- lead_time_daysINTEGER
- Days an order takes to arrive
First rows
| product_id | supplier_id | unit_cost | lead_time_days |
|---|---|---|---|
| 1 | 1 | 5.2 | 14 |
| 2 | 3 | 18 | 21 |
| 3 | 6 | 9.1 | 30 |
| 4 | 3 | 12.75 | 21 |
| 5 | 2 | 6.4 | 18 |
purchase_orders26 rows
Stock ordered from suppliers.
- po_idINTEGER
- Purchase order number
- supplier_idINTEGER
- Supplier
- product_idINTEGER
- Product
- ordered_onDATE
- Order date
- received_onDATE
- Date received (empty until it arrives)
- quantityINTEGER
- Quantity
- unit_costDECIMAL(8,2)
- Cost per unit
First rows
| po_id | supplier_id | product_id | ordered_on | received_on | quantity | unit_cost |
|---|---|---|---|---|---|---|
| 5001 | 3 | 18 | 2025-02-02 | 2025-02-28 | 40 | 8.75 |
| 5002 | 2 | 11 | 2025-05-24 | 2025-06-10 | 20 | 15.6 |
| 5003 | 2 | 5 | 2025-03-22 | 2025-04-11 | 80 | 6.4 |
| 5004 | 1 | 15 | 2025-05-19 | 2025-06-05 | 50 | 6.3 |
| 5005 | 1 | 15 | 2025-03-25 | 2025-04-07 | 10 | 6.3 |
tickets64 rows
Customer support tickets, times in UTC.
- ticket_idINTEGER
- Ticket number
- customer_idINTEGER
- Customer
- agent_idINTEGER
- Support agent (an employee)
- priorityVARCHAR
- Priority
- channelVARCHAR
- Channel
- subjectVARCHAR
- Subject
- opened_atTIMESTAMP
- Opened
- first_response_atTIMESTAMP
- First reply (empty until it happens)
- closed_atTIMESTAMP
- Closed (empty while open)
- satisfactionINTEGER
- Satisfaction score from 1 to 5
First rows
| ticket_id | customer_id | agent_id | priority | channel | subject | opened_at | first_response_at | closed_at | satisfaction |
|---|---|---|---|---|---|---|---|---|---|
| 7001 | 18 | 9 | normal | phone | Damaged on arrival | 2025-04-14 17:49:00 | 2025-04-14 20:04:00 | 2025-04-16 04:52:00 | |
| 7002 | 3 | 10 | high | Coupon not applied | 2025-05-05 10:40:00 | 2025-05-05 16:34:00 | |||
| 7003 | 10 | 9 | low | Coupon not applied | 2025-03-07 18:32:00 | 2025-03-07 23:37:00 | 2025-03-09 04:57:00 | 3 | |
| 7004 | 21 | 9 | normal | Cancel my order | 2025-04-23 18:23:00 | 2025-04-23 20:00:00 | 2025-04-26 11:09:00 | 2 | |
| 7005 | 15 | 9 | urgent | chat | Coupon not applied | 2025-05-03 13:57:00 | 2025-05-03 14:51:00 | 2025-05-04 18:15:00 | 4 |
events326 rows
Website activity, one row per event, in UTC.
- event_idINTEGER
- Event number
- visitor_idVARCHAR
- Browser identifier
- customer_idINTEGER
- Customer, once signed in
- event_timeTIMESTAMP
- Time of the event
- event_typeVARCHAR
- Event type, such as page_view
- product_idINTEGER
- Product, for product events
First rows
| event_id | visitor_id | customer_id | event_time | event_type | product_id |
|---|---|---|---|---|---|
| 1 | v007 | 3 | 2025-04-01 15:55:00 | page_view | |
| 2 | v007 | 3 | 2025-04-01 16:00:00 | product_view | 4 |
| 3 | v007 | 3 | 2025-04-01 19:33:00 | page_view | |
| 4 | v007 | 3 | 2025-04-01 19:34:00 | product_view | 2 |
| 5 | v007 | 3 | 2025-04-01 19:45:00 | add_to_cart | 2 |
stock_levels350 rows
Units in stock at the end of each day for eight products.
- product_idINTEGER
- Product
- dayDATE
- Date
- unitsINTEGER
- Units in stock
First rows
| product_id | day | units |
|---|---|---|
| 1 | 2025-03-01 | 47 |
| 1 | 2025-03-02 | 39 |
| 1 | 2025-03-04 | 25 |
| 1 | 2025-03-05 | 24 |
| 1 | 2025-03-06 | 19 |
memberships40 rows
Kestrel Plus memberships.
- membership_idINTEGER
- Membership number
- customer_idINTEGER
- Customer
- planVARCHAR
- Monthly or annual plan
- started_onDATE
- Start date
- ended_onDATE
- End date (empty while active)
- monthly_feeDECIMAL(5,2)
- Monthly fee
First rows
| membership_id | customer_id | plan | started_on | ended_on | monthly_fee |
|---|---|---|---|---|---|
| 301 | 3 | Monthly | 2025-01-06 | 6.99 | |
| 302 | 6 | Annual | 2024-01-31 | 4.99 | |
| 303 | 21 | Annual | 2024-03-14 | 4.99 | |
| 304 | 16 | Monthly | 2025-03-16 | 6.99 | |
| 305 | 5 | Monthly | 2024-05-27 | 6.99 |
campaigns5 rows
Marketing campaigns.
- campaign_idINTEGER
- Campaign number
- nameVARCHAR
- Campaign name
- channelVARCHAR
- Channel
- start_dateDATE
- Start date
- end_dateDATE
- End date
- budgetDECIMAL(10,2)
- Total budget in dollars
First rows
| campaign_id | name | channel | start_date | end_date | budget |
|---|---|---|---|---|---|
| 1 | Winter Warmers | 2025-01-02 | 2025-02-15 | 1200 | |
| 2 | New Year Nest | social | 2025-01-05 | 2025-01-31 | 2500 |
| 3 | Spring Refresh | search | 2025-03-01 | 2025-04-30 | 4000 |
| 4 | Garden Week | 2025-04-14 | 2025-04-21 | 600 | |
| 5 | Summer Preview | social | 2025-05-20 | 2025-06-15 | 1800 |
campaign_touches80 rows
Each click on a campaign link, in UTC.
- touch_idINTEGER
- Click number
- customer_idINTEGER
- Customer
- campaign_idINTEGER
- Campaign
- touched_atTIMESTAMP
- Time of the click
First rows
| touch_id | customer_id | campaign_id | touched_at |
|---|---|---|---|
| 1 | 5 | 1 | 2025-01-02 15:53:00 |
| 2 | 21 | 1 | 2025-01-06 18:15:00 |
| 3 | 16 | 1 | 2025-01-06 20:47:00 |
| 4 | 23 | 2 | 2025-01-07 08:14:00 |
| 5 | 17 | 2 | 2025-01-08 14:25:00 |
product_prices29 rows
Price history, one row per price.
- product_idINTEGER
- Product
- priceDECIMAL(8,2)
- Price
- valid_fromDATE
- First day of the price
- valid_toDATE
- Last day (empty for the current price)
First rows
| product_id | price | valid_from | valid_to |
|---|---|---|---|
| 1 | 12 | 2024-01-01 | 2024-09-30 |
| 1 | 13.5 | 2024-10-01 | 2024-12-31 |
| 1 | 14 | 2025-01-01 | |
| 2 | 39 | 2024-01-01 | 2024-11-14 |
| 2 | 42.5 | 2024-11-15 |
signups_raw28 rows
Newsletter sign-ups exactly as three web forms sent them, not cleaned.
- raw_idINTEGER
- Row number
- full_nameVARCHAR
- Name as typed
- emailVARCHAR
- Email as typed
- phoneVARCHAR
- Phone as typed
- signed_up_onVARCHAR
- Sign-up date
- sourceVARCHAR
- Form it came from
- age_textVARCHAR
- Age, typed as text
First rows
| raw_id | full_name | phone | signed_up_on | source | age_text | |
|---|---|---|---|---|---|---|
| 1 | Amara Okafor | [email protected] | 312-555-0141 | 2025-03-02 | footer | 34 |
| 2 | luis ortega | [email protected] | (512) 555-0188 | 2025-03-02 | popup | 29 |
| 3 | Mei Chen | [email protected] | 416 555 0123 | 2025-03-03 | checkout | 41 |
| 4 | AMARA OKAFOR | [email protected] | 3125550141 | 2025-03-05 | popup | 34 |
| 5 | Priya Natarajan | [email protected] | 2025-03-05 | footer | n/a |
order_export20 rows
A flat export from an old order system, one row per order line.
- order_idINTEGER
- Order number
- order_dateDATE
- Order date
- customer_nameVARCHAR
- Customer name
- customer_emailVARCHAR
- Customer email
- customer_cityVARCHAR
- Customer city
- product_nameVARCHAR
- Product name
- categoryVARCHAR
- Category
- unit_priceDECIMAL(8,2)
- Price per unit
- quantityINTEGER
- Quantity
First rows
| order_id | order_date | customer_name | customer_email | customer_city | product_name | category | unit_price | quantity |
|---|---|---|---|---|---|---|---|---|
| 9001 | 2024-11-02 | Rosa Vidal | [email protected] | San Antonio | Stoneware Mug | Kitchen | 13.5 | 4 |
| 9001 | 2024-11-02 | Rosa Vidal | [email protected] | San Antonio | Scented Candle | Decor | 16 | 2 |
| 9002 | 2024-11-03 | Ken Ito | [email protected] | Seattle | Cast Iron Skillet | Kitchen | 39 | 1 |
| 9003 | 2024-11-05 | Abena Owusu | [email protected] | Toronto | Waffle Bath Towel | Bath | 26 | 2 |
| 9003 | 2024-11-05 | Abena Owusu | [email protected] | Toronto | Cedar Bath Mat | Bath | 36 | 1 |
Questions
Which databases does the SQL script work in?
PostgreSQL, MySQL, SQLite and DuckDB. It drops and creates each table and inserts the rows, so you can run it again to reset the data.
Can I run queries without installing a database?
Yes. The SQL playground loads the main Kestrel tables in your browser, and the SQL course checks your queries against them.
More datasets
Retail sales dataset
Weekly sales by store and category, promotions and stock checks for a grocery chain.
Healthcare dataset
Patients, encounters, diagnoses, labs, medications, appointments and claims.
Shipping and logistics dataset
Freight shipments with promised and delivered dates, and their status events.
Customer churn dataset
Subscribers, cancellations, weekly workouts and an A/B test of an annual offer.
Employee and HR dataset
Employees, exits, salaries, recruiting, headcount and an engagement survey.