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
Isolate actually paid transactions — an energy supplier · training scenario
Isolate actually paid operations in the context of an energy supplier, with a controllable result. You must produce the result, check it on the source data and explain what it allows you to decide in this energy supplier.
Level : BeginnerCompare plansCompare value per city — one energy supplier · training scenario
Compare the value per city in the context of an energy supplier, with a controllable result. You must produce the result, check it on the source data and explain what it allows you to decide in this energy supplier.
Level : BeginnerCompare plansPrioritize amounts — an energy supplier · training scenario
Prioritize amounts in the context of an energy supplier, with a controllable outcome. You must produce the result, check it on the source data and explain what it allows you to decide in this energy supplier.
Level : BeginnerCompare plansCount volume by status — an energy supplier · training scenario
Count volume by status in the context of an energy supplier, with a controllable result. You must produce the result, check it on the source data and explain what it allows you to decide in this energy supplier.
Level : BeginnerCompare plansList active categories — an energy supplier · training scenario
List active categories in the context of an energy supplier, with a controllable result. You must produce the result, check it on the source data and explain what it allows you to decide in this energy supplier.
Level : BeginnerCompare plansMonitor monthly progress — an energy supplier · training scenario
Monitor monthly developments in the context of an energy supplier, with a controllable result. You must produce the result, check it on the source data and explain what it allows you to decide in this energy supplier.
Level : BeginnerCompare plansIsolate actually paid transactions — a tourism agency · training scenario
Isolate the operations actually paid in the context of a tourism agency, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this tourism agency.
Level : BeginnerCompare plansCompare value by city — a tourism agency · training scenario
Compare the value per city in the context of a tourism agency, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this tourism agency.
Level : BeginnerCompare plansPrioritize amounts — a tourism agency · training scenario
Prioritize amounts in the context of a tourism agency, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this tourism agency.
Level : BeginnerCompare plansCount volume by status — a tourism agency · training scenario
Count volume by status in the context of a tourism agency, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this tourism agency.
Level : BeginnerCompare plansList active categories — a tourism agency · training scenario
List active categories in the context of a tourism agency, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this tourism agency.
Level : BeginnerCompare plansMonitor monthly progress — a tourism agency · training scenario
Monitor monthly developments in the context of a tourism agency, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this tourism agency.
Level : BeginnerCompare plansRank results in each region — software subscriptions training scenario
Rank results in each region using a software subscription dataset designed to control level of detail and variance. You must produce the result, check it on the source data and explain what it allows you to decide in this software subscription.
Level : IntermediateCompare plansCompare each month to the previous one — software subscriptions · training scenario
Compare each month to the previous one using a software subscription 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 software subscription.
Level : IntermediateCompare plansBuilding a monthly rollup — software subscriptions · training scenario
Construct a monthly total from a software subscription 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 software subscription.
Level : IntermediateCompare plansSmoothing a two-month trend — software subscriptions · training scenario
Smooth a two-month trend from a software subscription 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 software subscription.
Level : AdvancedCompare plansProduce conditional KPIs by region — software subscriptions · training scenario
Produce conditional KPIs by region from a software subscription 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 software subscription.
Level : IntermediateCompare plansMeasure the contribution of each line — software subscriptions · training scenario
Measure the contribution of each line from a software subscription 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 software subscription.
Level : AdvancedCompare plansKeep top two lines per region — software subscriptions training scenario
Maintain the top two rows per region from a software subscription 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 software subscription.
Level : AdvancedCompare plansDivide results into quartiles — software subscriptions · training scenario
Divide results into quartiles from a software subscription dataset designed to control level of detail and variance. You must produce the result, check it on the source data and explain what it allows you to decide in this software subscription.
Level : AdvancedCompare plansCompare each value to its regional average — software subscriptions · training scenario
Compare each value to its regional average using a software subscription 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 software subscription.
Level : IntermediateCompare plansDetect duplicate business references — software subscriptions training scenario
Detect duplicate business references from a software subscription 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 software subscription.
Level : IntermediateCompare plansRank results in each region — national expeditions training scenario
Rank results in each region using a national shipment 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 national expeditions.
Level : IntermediateCompare plansCompare each month to the previous one — national expeditions · training scenario
Compare each month to the previous one using a national shipment 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 national expeditions.
Level : IntermediateCompare plansTwo focused paths reuse these experiences.