Back to Practice Hub

advanced SQL Challenges

Solve interactive scenarios to prove your capability in advanced-level queries using our live sandbox.

COMPLETED0 / 125
advancedWindow Functions 12m

Cumulative Sales Running Total

Calculate a cumulative running total of order sales revenue over time. Retrieve the `order_date`, the individual order's `total_amount`, and the running total aliased as `running_total`, sorted chronologically.

Window FunctionsSUM OVERRunning Total
Start Exercise
advancedWindow Functions 10m

Rank Customers by Total Spending

Calculate the total spending for each customer and rank them from highest spender to lowest. Display the customer's `name`, their `total_spent`, and their rank using `DENSE_RANK() OVER (...)` aliased as `spending_rank`.

DENSE_RANKGROUP BYWindow Functions
Start Exercise
advancedDate Functions 15m

Month-over-Month Sales Growth

Calculate the month-over-month percentage growth in sales revenue. Return the year-month string (formatted as 'YYYY-MM'), the monthly revenue (aliased as `monthly_revenue`), the previous month's revenue (aliased as `prev_month_revenue`), and the percentage growth (aliased as `growth_percentage`, rounded to 2 decimal places).

LAGstrftimeWindow FunctionsROUND
Start Exercise
advancedCTE 10m

Generate Numeric Sequences

Write a recursive Common Table Expression (CTE) to generate a single-column table containing numbers from 1 to 10. Alias the column as `num`.

WITH RECURSIVEUnion All
Start Exercise
advancedAdvanced SQL 20m

Consecutive Days Sales Streaks

Identify consecutive days where at least one order was placed. For each consecutive streak, return the start date (`streak_start`), the end date (`streak_end`), and the number of consecutive days (`consecutive_days`). Sort by `consecutive_days` descending.

Gaps & IslandsWindow SubtractionROW_NUMBERDATE
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 2)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 6)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 10)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 14)

Retrieve the name and price of all products that cost less than $190 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 18)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 22)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 26)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 30)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 34)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 38)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 42)

Retrieve the name and price of all products that cost less than $70 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 46)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 50)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 54)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 58)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 62)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 66)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 70)

Retrieve the name and price of all products that cost less than $150 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 74)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 78)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 82)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 86)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 90)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 94)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 98)

Retrieve the name and price of all products that cost less than $230 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 102)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 106)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 110)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 114)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 118)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 122)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 126)

Retrieve the name and price of all products that cost less than $110 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 130)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 134)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 138)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 142)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 146)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 150)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 154)

Retrieve the name and price of all products that cost less than $190 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 158)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 162)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 166)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 170)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 174)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 178)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 182)

Retrieve the name and price of all products that cost less than $70 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 186)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 190)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 194)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 198)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 202)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 206)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 210)

Retrieve the name and price of all products that cost less than $150 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 214)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 218)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 222)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 226)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 230)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 234)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 238)

Retrieve the name and price of all products that cost less than $230 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 242)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 246)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 250)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 254)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 258)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 262)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 266)

Retrieve the name and price of all products that cost less than $110 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 270)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 274)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 278)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 282)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 286)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 290)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 294)

Retrieve the name and price of all products that cost less than $190 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 298)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 302)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 306)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 310)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 314)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 318)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 322)

Retrieve the name and price of all products that cost less than $70 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 326)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 330)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 334)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 338)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 342)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 346)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 350)

Retrieve the name and price of all products that cost less than $150 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 354)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 358)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 362)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 366)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 370)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 374)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 378)

Retrieve the name and price of all products that cost less than $230 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 382)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 386)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 390)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 394)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 398)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 402)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 406)

Retrieve the name and price of all products that cost less than $110 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 410)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 414)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 418)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 422)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 426)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 430)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 434)

Retrieve the name and price of all products that cost less than $190 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 438)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 442)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 446)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 450)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise
advancedJoins 8m

Join Customer Orders (Scenario 454)

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.

JOINONColumn Selection
Start Exercise
advancedDate Functions 6m

Orders Placed in Specific Month (Batch 458)

Retrieve all orders placed in the month of '05' 2026. Use date string matching or strftime.

strftimeDate Filter
Start Exercise
advancedSQL Basics 5m

Select Products Under Limit (Case 462)

Retrieve the name and price of all products that cost less than $70 from the products table.

SELECTWHEREComparison
Start Exercise
advancedGROUP BY 7m

Orders Count per Customer (Audit 466)

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.

GROUP BYCOUNTORDER BY
Start Exercise
advancedCTE 9m

CTE High Value Sales Analysis (Batch 470)

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.

WITHCTEGROUP BYCOUNT
Start Exercise
advancedAdvanced SQL 12m

Top Selling Product Details (Scenario 474)

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`).

SUMGROUP BYLIMITSubqueries
Start Exercise
advancedSorting 5m

Sort Products by Category and Price (Type 478)

Retrieve all products sorted alphabetically by category, and then from cheapest to most expensive within each category.

ORDER BYMultiple Columns
Start Exercise