SQL practice exercises

One skill at a time on generated tables. When you are ready, take the full SQL test.

SELECT and WHERE

SQL warm-up: SELECT / WHERE on the orders table.

Test #2411 1 questions about 8 min 0:00 SQLite: loading…
customers · 13 rows · header in row 1
AidBnameCregionDcity
21Fatima ReyesEastMesa
32Aisha NakamuraWestOmaha
43Ruth PriceSouthTulsa
54Elena OkaforEastBoise
65Hannah BennettSouthFresno
76Irene NovakWestMesa
87Elena LindqvistNorthReno
98Hector ShahEastTulsa
109Victor MurphyWestBoise
1110Emily PatelEastBoise
1211Ethan OkaforEastBoise
1312Priya GrantWestTulsa

Tables are loaded into an in-browser SQLite database (sql.js). Write a query per question, press Run (or Check all). Only the result set is graded — aliases and extra whitespace are fine.

  1. 1

    Return the id and amount of every order with amount >= 235. Order by id ascending.

    SELECTWHERE

JOINs

SQL warm-up: JOIN customers and products to an order.

Test #2412 1 questions about 8 min 0:00 SQLite: loading…
customers · 11 rows · header in row 1
AidBnameCregionDcity
21Fatima DuboisSouthBoise
32Hector PriceNorthDayton
43Elena LopezSouthOmaha
54Marcus LindqvistNorthBoise
65Omar MendozaEastReno
76Ruth IbrahimSouthReno
87Emily WalshSouthOmaha
98Liam RiveraWestBoise
109Priya MurphyEastMesa
1110Olivia PriceSouthTulsa
1211Maria ChenSouthMesa

Tables are loaded into an in-browser SQLite database (sql.js). Write a query per question, press Run (or Check all). Only the result set is graded — aliases and extra whitespace are fine.

  1. 1

    For order id 1020, return the customer name as customer_name and the product name as product_name (one row).

    JOIN

GROUP BY and HAVING

SQL warm-up: GROUP BY / HAVING on revenue by region.

Test #2413 1 questions about 8 min 0:00 SQLite: loading…
customers · 10 rows · header in row 1
AidBnameCregionDcity
21Olivia MorganWestProvo
32Chloe PriceEastReno
43Nguyen HughesWestTulsa
54Mei HughesSouthBoise
65Kwame BrooksSouthTulsa
76Emily ChenSouthDayton
87Aisha MendozaSouthOmaha
98Rosa JohnsonEastTulsa
109Nguyen DuboisSouthFresno
1110Priya TranSouthBoise

Tables are loaded into an in-browser SQLite database (sql.js). Write a query per question, press Run (or Check all). Only the result set is graded — aliases and extra whitespace are fine.

  1. 1

    For each customer region, return region and total_amount (SUM of order amounts) only for regions whose total_amount is greater than 914.

    GROUP BYHAVINGJOIN

Window RANK

SQL warm-up: RANK window over product revenue.

Test #2414 1 questions about 10 min 0:00 SQLite: loading…
customers · 11 rows · header in row 1
AidBnameCregionDcity
21Emily GarciaSouthTulsa
32Rosa RiveraEastOmaha
43Aisha MurphyWestBoise
54Liam JohnsonWestDayton
65Priya OkaforSouthFresno
76Marcus PatelSouthReno
87Emily OrtizWestFresno
98Andre HughesWestBoise
109Ruth DelgadoWestFresno
1110Omar ReyesSouthOmaha
1211Elena TranSouthDayton

Tables are loaded into an in-browser SQLite database (sql.js). Write a query per question, press Run (or Check all). Only the result set is graded — aliases and extra whitespace are fine.

  1. 1

    For each product, return product_name, revenue (SUM of order amounts), and revenue_rank using RANK() ordered by revenue descending (ties share a rank). Order the output by revenue descending, then product id.

    WindowRANKJOIN

Questions people ask

How do these differ from the full SQL test?

Each set below drills one skill with a single question on a fresh generated database. Use them to warm up, then take the full seven-question SQL test.

Is this Power BI or a vendor SQL exam?

No. Plain SQLite practice we generate and grade ourselves. No vendor branding.

Keep practicing

Browse all tests by type, topic or job