Interactive SQL exercises
Solved SQL exercises: practise from beginner to advanced
Practise SQL online through progressive business cases. Each exercise provides fictional data, hints, result validation and an explained solution.
Select the correct columns
Show only the name and price of each product.
Level : BeginnerOpen exerciseFilter and sort orders
Find orders over €50, from highest to lowest.
Level : BeginnerOpen exerciseConnect customers and orders
Associate each order with the name of the customer who placed it.
Level : IntermediateCompare plansList unique categories
Display the first three unique categories in alphabetical order.
Level : BeginnerCreate a free accountReplace a NULL value with COALESCE
Display clear labeling when a customer’s phone is absent.
Level : BeginnerCreate a free accountCalculate paid order indicators
Calculate the volume, total and average over a specific area.
Level : BeginnerCompare plansGroup revenue by category
Calculate totals by category and keep only the most important ones.
Level : BeginnerCompare plansKeep customers without orders
Count the orders of each customer without excluding new registrants.
Level : BeginnerCompare plansSegment customers with a CTE
Calculate the total per customer, then transform this result into a business segment.
Level : IntermediateCompare plansFilter a price range
Select an inclusive interval and check its limits.
Level : BeginnerCreate a free accountFilter multiple statuses
Replace multiple OR with a readable business list.
Level : BeginnerCreate a free accountSearch for a prefix with LIKE
Use a simple text pattern without confusing prefix and content.
Level : BeginnerCreate a free accountIdentify missing deliveries
Distinguish a missing date from an empty string or status.
Level : BeginnerCreate a free accountCalculate a price including tax
Transform a source price with a precise formula and alias.
Level : BeginnerCreate a free accountAssemble a product label
Create a readable label from two columns.
Level : BeginnerCreate a free accountNormalize a list of cities
Create a clean dimension before counting customers.
Level : BeginnerCreate a free accountExtract the year of registration
Derive a calendar component without transforming the scope.
Level : BeginnerCompare plansCalculate monthly revenue
Group together several channels over the same monthly period.
Level : IntermediateCompare plansAnalyze a quarter with limits
Filter a complete period with an exclusive upper bound.
Level : IntermediateCompare plansFind customers without orders
Keep the starting population and isolate the absence of activity.
Level : IntermediateCompare plansTest for the existence of a large order
Filter a population without duplicating it by its history.
Level : IntermediateCompare plansCalculate the average basket per customer
Only aggregate orders that are actually paid.
Level : IntermediateCompare plansCompare to average price
Use an aggregated value as a dynamic threshold.
Level : IntermediateCompare plansMerge customers and prospects
Create a single list from two compatible sources.
Level : IntermediateCompare plansTraining scenariosThese contextual repetitions reinforce an existing method. They preserve every historical link without pretending to be new canonical problems.Browse 118 scenarios
Keep the two best lines per region — acquisition campaigns · training scenario
Maintain the top two rows per region from an acquisition campaign dataset designed to control level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this acquisition campaign.
Level : AdvancedCompare plansDivide the results into quartiles — acquisition campaigns · training scenario
Divide results into quartiles from an acquisition campaign dataset designed to control the level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this acquisition campaign.
Level : AdvancedCompare plansCompare each value to its regional average — acquisition campaigns · training scenario
Compare each value to its regional average using an acquisition campaign dataset designed to control the level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this acquisition campaign.
Level : IntermediateCompare plansDetect duplicate business references — acquisition campaigns · training scenario
Detect duplicate business references from an acquisition campaign dataset designed to control level of detail and discrepancies. You must produce the result, check it on the source data and explain what it allows you to decide in this acquisition campaign.
Level : IntermediateCompare plansRank results in each region — support tickets · training scenario
Rank results in each region based on a support ticket dataset designed to control level of detail and discrepancies. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : IntermediateCompare plansCompare each month to the previous one — support tickets · training scenario
Compare each month to the previous one using a support ticket dataset designed to monitor level of detail and discrepancies. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : IntermediateCompare plansBuilding a monthly rollup — support tickets · training scenario
Build a monthly total from a support ticket dataset designed to control the level of detail and discrepancies. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : IntermediateCompare plansSmoothing a two-month trend — support tickets · training scenario
Smooth a two-month trend from a support ticket dataset designed to control level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : AdvancedCompare plansProduce conditional KPIs by region — support tickets · training scenario
Produce conditional KPIs by region from a support ticket dataset designed to monitor level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : IntermediateCompare plansMeasure the contribution of each line — support tickets · training scenario
Measure each line's contribution from a support ticket dataset designed to monitor level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : AdvancedCompare plansKeep top two lines per region — support tickets · training scenario
Maintain the top two rows per region from a support ticket dataset designed to control level of detail and discrepancies. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : AdvancedCompare plansDivide results into quartiles — support tickets · training scenario
Divide results into quartiles from a support ticket dataset designed to control level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : AdvancedCompare plansCompare each value to its regional average — support tickets · training scenario
Compare each value to its regional average using a support ticket dataset designed to monitor level of detail and variances. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : IntermediateCompare plansDetect duplicate business references — support tickets · training scenario
Detect duplicate business references from a support ticket dataset designed to control level of detail and discrepancies. You must produce the result, check it on the source data and explain what it allows you to decide in this support ticket.
Level : IntermediateCompare plansCreate a controlled table for invoicing 2 training scenario
Create a structure that rejects duplicate IDs and negative values. You must produce the result, check it on the source data and explain what it allows you to decide in this billing system.
Level : AdvancedCompare plansCreate a controlled table for logistics 3 training scenario
Create a structure that rejects duplicate IDs and negative values. You must produce the result, check it on the source data and explain what it allows you to decide in this national expeditions.
Level : AdvancedCompare plansCreate a controlled table for rh 4 · training scenario
Create a structure that rejects duplicate IDs and negative values. You must produce the result, control it on the source data and explain what it allows you to decide in this human resources management.
Level : AdvancedCompare plansCreate a controlled table for audit 5 · training scenario
Create a structure that rejects duplicate IDs and negative values. You must produce the result, check it on the source data and explain what it allows you to decide in this audit log.
Level : AdvancedCompare plansInsert then update billing data 2 · training scenario
Make two controlled changes and check the final state. You must produce the result, check it on the source data and explain what it allows you to decide in this billing system.
Level : AdvancedCompare plansInsert then update logistics data 3 · training scenario
Make two controlled changes and check the final state. You must produce the result, check it on the source data and explain what it allows you to decide in this national expeditions.
Level : AdvancedCompare plansInsert then update HR data 4 · training scenario
Make two controlled changes and check the final state. You must produce the result, control it on the source data and explain what it allows you to decide in this human resources management.
Level : AdvancedCompare plansInsert then update audit data 5 · training scenario
Make two controlled changes and check the final state. You must produce the result, check it on the source data and explain what it allows you to decide in this audit log.
Level : AdvancedCompare plansProtect a billing change 2 training scenario
Commit a correct change and undo only the incorrect step. You must produce the result, check it on the source data and explain what it allows you to decide in this billing system.
Level : AdvancedCompare plansProtect a logistics change 3 training scenario
Commit a correct change and undo only the incorrect step. You must produce the result, check it on the source data and explain what it allows you to decide in this national expeditions.
Level : AdvancedCompare plansTwo focused paths reuse these experiences.