beginner SQL Challenges
Solve interactive scenarios to prove your capability in beginner-level queries using our live sandbox.
Select All Products
Write a query to retrieve all columns and all rows from the `products` table. This is the starting point for exploring database records.
Select Specific Columns
Retrieve only the `name` and `price` columns for all records in the `products` table.
Find USA Customers
Filter the `customers` table to find the `name`, `email`, and `country` of all customers who reside in the 'USA'.
Sort Products by Price
Write a query to retrieve the `name` and `price` of all products, sorted from the most expensive to the cheapest.
Calculate Average Product Price
Calculate the average price of all products in the `products` table. Alias the result column as `average_price`.
Orders Count per Customer (Audit 4)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 8)
Define a Common Table Expression to isolate orders greater than $500. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 12)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 16)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 20)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 24)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 28)
Retrieve the name and price of all products that cost less than $130 from the products table.
Orders Count per Customer (Audit 32)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 36)
Define a Common Table Expression to isolate orders greater than $300. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 40)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 44)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 48)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 52)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 56)
Retrieve the name and price of all products that cost less than $210 from the products table.
Orders Count per Customer (Audit 60)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 64)
Define a Common Table Expression to isolate orders greater than $600. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 68)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 72)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 76)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 80)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 84)
Retrieve the name and price of all products that cost less than $90 from the products table.
Orders Count per Customer (Audit 88)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 92)
Define a Common Table Expression to isolate orders greater than $400. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 96)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 100)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 104)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 108)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 112)
Retrieve the name and price of all products that cost less than $170 from the products table.
Orders Count per Customer (Audit 116)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 120)
Define a Common Table Expression to isolate orders greater than $200. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 124)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 128)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 132)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 136)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 140)
Retrieve the name and price of all products that cost less than $50 from the products table.
Orders Count per Customer (Audit 144)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 148)
Define a Common Table Expression to isolate orders greater than $500. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 152)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 156)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 160)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 164)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 168)
Retrieve the name and price of all products that cost less than $130 from the products table.
Orders Count per Customer (Audit 172)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 176)
Define a Common Table Expression to isolate orders greater than $300. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 180)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 184)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 188)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 192)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 196)
Retrieve the name and price of all products that cost less than $210 from the products table.
Orders Count per Customer (Audit 200)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 204)
Define a Common Table Expression to isolate orders greater than $600. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 208)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 212)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 216)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 220)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 224)
Retrieve the name and price of all products that cost less than $90 from the products table.
Orders Count per Customer (Audit 228)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 232)
Define a Common Table Expression to isolate orders greater than $400. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 236)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 240)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 244)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 248)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 252)
Retrieve the name and price of all products that cost less than $170 from the products table.
Orders Count per Customer (Audit 256)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 260)
Define a Common Table Expression to isolate orders greater than $200. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 264)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 268)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 272)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 276)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 280)
Retrieve the name and price of all products that cost less than $50 from the products table.
Orders Count per Customer (Audit 284)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 288)
Define a Common Table Expression to isolate orders greater than $500. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 292)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 296)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 300)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 304)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 308)
Retrieve the name and price of all products that cost less than $130 from the products table.
Orders Count per Customer (Audit 312)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 316)
Define a Common Table Expression to isolate orders greater than $300. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 320)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 324)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 328)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 332)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 336)
Retrieve the name and price of all products that cost less than $210 from the products table.
Orders Count per Customer (Audit 340)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 344)
Define a Common Table Expression to isolate orders greater than $600. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 348)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 352)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 356)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 360)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 364)
Retrieve the name and price of all products that cost less than $90 from the products table.
Orders Count per Customer (Audit 368)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 372)
Define a Common Table Expression to isolate orders greater than $400. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 376)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 380)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 384)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 388)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 392)
Retrieve the name and price of all products that cost less than $170 from the products table.
Orders Count per Customer (Audit 396)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 400)
Define a Common Table Expression to isolate orders greater than $200. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 404)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 408)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 412)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 416)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 420)
Retrieve the name and price of all products that cost less than $50 from the products table.
Orders Count per Customer (Audit 424)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 428)
Define a Common Table Expression to isolate orders greater than $500. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 432)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 436)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 440)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 444)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 448)
Retrieve the name and price of all products that cost less than $130 from the products table.
Orders Count per Customer (Audit 452)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.
CTE High Value Sales Analysis (Batch 456)
Define a Common Table Expression to isolate orders greater than $300. In the main query, count how many such high-value orders exist per customer.
Top Selling Product Details (Scenario 460)
Write a query using a subquery or window function to find the name of the product that has been ordered in the highest total quantity (sum of `quantity`).
Sort Products by Category and Price (Type 464)
Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.
Join Customer Orders (Scenario 468)
Write a query to retrieve the order id, order date, total amount, and the customer's name for all orders in the database. Sort chronologically.
Orders Placed in Specific Month (Batch 472)
Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.
Select Products Under Limit (Case 476)
Retrieve the name and price of all products that cost less than $210 from the products table.
Orders Count per Customer (Audit 480)
Find the total number of orders placed by each customer. Retrieve the customer_id and the order count aliased as `order_count`, sorted by `order_count` descending.