Country or region and language

    Choose your country or region and your language.

    Suggested for you

      All countries and regions

        Choose your character

        It shows in the top bar and on your profile. Change it any time.

        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

        CSV files, one per table

        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.

        1. Join orders, order_items and products to find revenue by category.
        2. Use a LEFT JOIN from customers to orders to find customers who never ordered.
        3. Join employees to itself on manager_id to list each person's manager.
        4. Clean signups_raw: trim names, fix emails and turn age_text into 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_idnamecategorypricecostunits_in_stock
        1Stoneware MugKitchen145.2120
        2Cast Iron SkilletKitchen42.51835
        3Bamboo Cutting BoardKitchen24.999.164
        4French PressKitchen3212.750
        5Linen Napkins (Set of 4)Kitchen19.56.488

        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_idfirst_namelast_nameemailcitycountrysignup_dateloyalty_tier
        1AmaraOkafor[email protected]ChicagoUSA2023-02-14Gold
        2LuisOrtega[email protected]AustinUSA2023-04-03Silver
        3MeiChen[email protected]TorontoCanada2023-05-21Gold
        4PriyaNatarajan[email protected]LondonUK2023-06-09Bronze
        5JonasLindqvist[email protected]TorontoCanada2023-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_idcustomer_idorder_dateshipped_datestatuscoupon_codetotal
        100112025-01-042025-01-05delivered92
        100232025-01-062025-01-08deliveredWELCOME1089
        100372025-01-092025-01-10delivered67.49
        100422025-01-122025-01-15returned129
        1005122025-01-152025-01-17delivered68.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_idorder_idproduct_idquantityunit_price
        110011414
        2100115218
        310029189
        410032142.5
        510033124.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_idfirst_namelast_namedepartmentjob_titlemanager_idhire_datesalary
        1RosaDelgadoExecutiveChief Executive2019-03-04185000
        2MarcusWebbEngineeringHead of Engineering12019-08-19162000
        3AnjaliRaoEngineeringSoftware Engineer22021-02-01128000
        4BenCarterEngineeringSoftware Engineer22022-06-13119000
        5LinaParkEngineeringData Analyst22023-01-0998000

        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_idnamecountrycontact_emailrating
        1Northfield CeramicsUK[email protected]4.6
        2Pinegate TextilesPortugal[email protected]4.2
        3Ashby MetalworksUSA3.9
        4Saltmarsh CandlesCanada[email protected]4.8
        5Verdant Garden SupplyNetherlands[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_idsupplier_idunit_costlead_time_days
        115.214
        231821
        369.130
        4312.7521
        526.418

        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_idsupplier_idproduct_idordered_onreceived_onquantityunit_cost
        50013182025-02-022025-02-28408.75
        50022112025-05-242025-06-102015.6
        5003252025-03-222025-04-11806.4
        50041152025-05-192025-06-05506.3
        50051152025-03-252025-04-07106.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_idcustomer_idagent_idprioritychannelsubjectopened_atfirst_response_atclosed_atsatisfaction
        7001189normalphoneDamaged on arrival2025-04-14 17:49:002025-04-14 20:04:002025-04-16 04:52:00
        7002310highemailCoupon not applied2025-05-05 10:40:002025-05-05 16:34:00
        7003109lowemailCoupon not applied2025-03-07 18:32:002025-03-07 23:37:002025-03-09 04:57:003
        7004219normalemailCancel my order2025-04-23 18:23:002025-04-23 20:00:002025-04-26 11:09:002
        7005159urgentchatCoupon not applied2025-05-03 13:57:002025-05-03 14:51:002025-05-04 18:15:004

        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_idvisitor_idcustomer_idevent_timeevent_typeproduct_id
        1v00732025-04-01 15:55:00page_view
        2v00732025-04-01 16:00:00product_view4
        3v00732025-04-01 19:33:00page_view
        4v00732025-04-01 19:34:00product_view2
        5v00732025-04-01 19:45:00add_to_cart2

        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_iddayunits
        12025-03-0147
        12025-03-0239
        12025-03-0425
        12025-03-0524
        12025-03-0619

        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_idcustomer_idplanstarted_onended_onmonthly_fee
        3013Monthly2025-01-066.99
        3026Annual2024-01-314.99
        30321Annual2024-03-144.99
        30416Monthly2025-03-166.99
        3055Monthly2024-05-276.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_idnamechannelstart_dateend_datebudget
        1Winter Warmersemail2025-01-022025-02-151200
        2New Year Nestsocial2025-01-052025-01-312500
        3Spring Refreshsearch2025-03-012025-04-304000
        4Garden Weekemail2025-04-142025-04-21600
        5Summer Previewsocial2025-05-202025-06-151800

        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_idcustomer_idcampaign_idtouched_at
        1512025-01-02 15:53:00
        22112025-01-06 18:15:00
        31612025-01-06 20:47:00
        42322025-01-07 08:14:00
        51722025-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_idpricevalid_fromvalid_to
        1122024-01-012024-09-30
        113.52024-10-012024-12-31
        1142025-01-01
        2392024-01-012024-11-14
        242.52024-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_idfull_nameemailphonesigned_up_onsourceage_text
        1Amara Okafor[email protected]312-555-01412025-03-02footer34
        2 luis ortega[email protected] (512) 555-01882025-03-02popup29
        3Mei Chen[email protected]416 555 01232025-03-03checkout 41
        4AMARA OKAFOR[email protected]31255501412025-03-05popup34
        5Priya Natarajan[email protected]2025-03-05footern/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_idorder_datecustomer_namecustomer_emailcustomer_cityproduct_namecategoryunit_pricequantity
        90012024-11-02Rosa Vidal[email protected]San AntonioStoneware MugKitchen13.54
        90012024-11-02Rosa Vidal[email protected]San AntonioScented CandleDecor162
        90022024-11-03Ken Ito[email protected]SeattleCast Iron SkilletKitchen391
        90032024-11-05Abena Owusu[email protected]TorontoWaffle Bath TowelBath262
        90032024-11-05Abena Owusu[email protected]TorontoCedar Bath MatBath361

        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

        Free practice datasets

        Your Work Gym account

        Save your progress and pick up on another device. Your browser's progress comes with you.

        New accounts get 12 hours of full access: every course, unit, project and exam. The clock starts when you open your first lesson.

        Plan your practice from a job ad or syllabus

        Have a referral code?

        or

        You can keep practicing without an account.

        Change your plan

        Checking the price

        Help and feedback

        Ask a question, tell us what is not working, or share an idea. We reply by email.

        What is it about?

        We use it only to reply to you.