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.
Keep origin with UNION ALL
Stack two lists without losing traceability.
Level : IntermediateCompare plansFind the intersection of two lists
Keep only the values present in both sets.
Level : IntermediateCompare plansConnect a table to itself
Represent a simple hierarchy with two aliases.
Level : IntermediateCompare plansCalculate revenue using three tables
Follow the keys without adding a measure twice.
Level : IntermediateCompare plansClassify inventory risk
Transform operational thresholds into readable categories.
Level : IntermediateCompare plansMeasure phone completeness
Produce a quality rate from explicit volumes.
Level : IntermediateCompare plansDetect duplicate emails
Transform a uniqueness constraint into measurable control.
Level : IntermediateCompare plansReconcile orders and payments
Compare two independent totals in a single control line.
Level : IntermediateCompare plansCalculate the overall margin with a CTE
Separate basic measurements and derived indicators.
Level : IntermediateCompare plansRank the top three categories
Prepare a reliable aggregate before limiting the ranking.
Level : IntermediateCompare plansCalculate multiple statuses in one line
Build conditional indicators without multiplying queries.
Level : IntermediateCompare plansFilter an average basket with HAVING
Apply a threshold on an aggregated indicator.
Level : IntermediateCompare plansFind the first order
Bring back a history to its first date per customer.
Level : IntermediateCompare plansCompare each month to the previous one
Align two periods to calculate an absolute evolution.
Level : IntermediateCompare plansCalculate margin by category
Distinguish between revenue, cost and margin on paid lines.
Level : IntermediateCompare plansTrack monthly payment rate
Combine timing and conditional aggregation into one monitorable indicator.
Level : IntermediateCompare plansFilter then sort a threshold
Keep the threshold inclusive and make the outcome controllable.
Level : BeginnerOpen exerciseSelect multiple brands
Express a closed list without repeating multiple OR.
Level : BeginnerCreate a free accountCalculate a unit margin
Create a simple indicator from two compatible columns.
Level : BeginnerCreate a free accountControl the length of names
Measure text before exporting to a limited size.
Level : BeginnerCreate a free accountAvoid double counting after several joins
Calculate customer revenue without multiplying lines when an order has multiple items and multiple payments.
Level : AdvancedCompare plansBuilding a cohort and measuring retention
Go from raw events to a retention matrix without double-counting an active account.
Level : AdvancedCompare plansBuild a complete RFM segmentation
Measure recency, frequency, and value, then turn scores into actionable segments.
Level : AdvancedCompare plansMeasure a funnel without counting duplicate events
Transform an imperfect event log into conversion rates by stage and channel.
Level : AdvancedCompare 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 — a regional bookstore · training scenario
Isolate the actually paid operations in the context of a regional bookstore, 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 network of bookstores.
Level : BeginnerCompare plansCompare value by city — a regional bookstore · training scenario
Compare the value by city in the context of a regional bookstore, 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 network of bookstores.
Level : BeginnerCompare plansPrioritize amounts — a regional bookstore · training scenario
Prioritize amounts in the context of a regional bookstore, 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 network of bookstores.
Level : BeginnerCompare plansCount volume by status — a regional bookstore · training scenario
Count volume by status in the context of a regional bookstore, 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 network of bookstores.
Level : BeginnerCompare plansList active categories — a regional bookstore · training scenario
List active categories in the context of a regional bookstore, 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 network of bookstores.
Level : BeginnerCompare plansFollow monthly progress — a regional bookstore · training scenario
Monitor monthly developments in the context of a regional bookstore, 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 network of bookstores.
Level : BeginnerCompare plansIsolating actually paid operations — a network of clinics · training scenario
Isolate actually paid operations in the context of a network of clinics, 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 network of clinics.
Level : BeginnerCompare plansCompare value by city — a network of clinics · training scenario
Compare the value by city in the context of a network of clinics, 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 network of clinics.
Level : BeginnerCompare plansPrioritize amounts — a network of clinics · training scenario
Prioritize amounts in the context of a network of clinics, 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 network of clinics.
Level : BeginnerCompare plansCount volume by status — a network of clinics · training scenario
Count volume by status in the context of a network of clinics, 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 network of clinics.
Level : BeginnerCompare plansList active categories — a network of clinics · training scenario
List active categories in the context of a network of clinics, 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 network of clinics.
Level : BeginnerCompare plansMonitor monthly progress — a network of clinics · training scenario
Monitor monthly developments in the context of a network of clinics, 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 network of clinics.
Level : BeginnerCompare plansIsolating actually paid transactions — a training organization · training scenario
Isolate the operations actually paid in the context of a training organization, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this training organization.
Level : BeginnerCompare plansCompare value by city — a training organization · training scenario
Compare the value per city in the context of a training organization, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this training organization.
Level : BeginnerCompare plansPrioritize amounts — a training organization · training scenario
Prioritize amounts in the context of a training organization, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this training organization.
Level : BeginnerCompare plansCount volume by status — a training organization · training scenario
Count the volume by status in the context of a training organization, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this training organization.
Level : BeginnerCompare plansList active categories — a training organization · training scenario
List active categories in the context of a training organization, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this training organization.
Level : BeginnerCompare plansMonitor monthly progress — a training organization · training scenario
Monitor monthly progress in the context of a training organization, with a controllable result. You must produce the result, check it on the source data and explain what it allows to decide in this training organization.
Level : BeginnerCompare plansIsolate actual paid transactions — a delivery company · training scenario
Isolate actual paid operations in the context of a delivery business, 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 delivery company.
Level : BeginnerCompare plansCompare value by city — a delivery company · training scenario
Compare the value by city in the context of a delivery company, 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 delivery company.
Level : BeginnerCompare plansPrioritize amounts — a delivery company · training scenario
Prioritize amounts in the context of a delivery business, 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 delivery company.
Level : BeginnerCompare plansCount volume by status — a delivery company · training scenario
Count volume by status in the context of a delivery business, 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 delivery company.
Level : BeginnerCompare plansList active categories — a delivery company · training scenario
List active categories in the context of a delivery business, 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 delivery company.
Level : BeginnerCompare plansMonitor monthly progress — a delivery company · training scenario
Monitor monthly progress in the context of a delivery company, 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 delivery company.
Level : BeginnerCompare plansTwo focused paths reuse these experiences.