Guided practice

Understand the need. Write the query. Defend your result.

Every exercise combines a business context, an approach, hints, a SQL environment, detailed feedback and an extra challenge.

44 exercises shown
SELECTNo account

Select the correct columns

Show only the name and price of each product.

Level : BeginnerOpen exercise
WHERE · ORDER BYNo account

Filter and sort orders

Find orders over 50 TND, from highest to lowest.

Level : BeginnerOpen exercise
INNER JOINSQL Essentials

Connect customers and orders

Associate each order with the name of the customer who placed it.

Level : IntermediateView SQL Essentials
DISTINCT · LIMITDiscovery space

List unique categories

Display the first three unique categories in alphabetical order.

Level : BeginnerCreate a free account
NULL · COALESCEDiscovery space

Replace a NULL value with COALESCE

Display clear labeling when a customer’s phone is absent.

Level : BeginnerCreate a free account
COUNT · SUM · AVGSQL Essentials

Calculate paid order indicators

Calculate the volume, total and average over a specific area.

Level : BeginnerView SQL Essentials
GROUP BY · HAVINGSQL Essentials

Group revenue by category

Calculate totals by category and keep only the most important ones.

Level : BeginnerView SQL Essentials
LEFT JOIN · COUNTSQL Essentials

Keep customers without orders

Count the orders of each customer without excluding new registrants.

Level : BeginnerView SQL Essentials
CTE · CASESQL Essentials

Segment customers with a CTE

Calculate the total per customer, then transform this result into a business segment.

Level : IntermediateView SQL Essentials
BETWEENDiscovery space

Filter a price range

Select an inclusive interval and check its limits.

Level : BeginnerCreate a free account
INDiscovery space

Filter multiple statuses

Replace multiple OR with a readable business list.

Level : BeginnerCreate a free account
LIKEDiscovery space

Search for a prefix with LIKE

Use a simple text pattern without confusing prefix and content.

Level : BeginnerCreate a free account
IS NULLDiscovery space

Identify missing deliveries

Distinguish a missing date from an empty string or status.

Level : BeginnerCreate a free account
Expressions · ROUNDDiscovery space

Calculate a price including tax

Transform a source price with a precise formula and alias.

Level : BeginnerCreate a free account
Text · ConcatenationDiscovery space

Assemble a product label

Create a readable label from two columns.

Level : BeginnerCreate a free account
TRIM · UPPER · DISTINCTDiscovery space

Normalize a list of cities

Create a clean dimension before counting customers.

Level : BeginnerCreate a free account
Dates · EXTRACTSQL Essentials

Extract the year of registration

Derive a calendar component without transforming the scope.

Level : BeginnerView SQL Essentials
Dates · GROUP BYSQL Essentials

Calculate monthly revenue

Group together several channels over the same monthly period.

Level : IntermediateView SQL Essentials
Dates · WHERESQL Essentials

Analyze a quarter with limits

Filter a complete period with an exclusive upper bound.

Level : IntermediateView SQL Essentials
LEFT JOIN · HAVINGSQL Essentials

Find customers without orders

Keep the starting population and isolate the absence of activity.

Level : IntermediateView SQL Essentials
EXISTSSQL Essentials

Test for the existence of a large order

Filter a population without duplicating it by its history.

Level : IntermediateView SQL Essentials
JOIN · AVGSQL Essentials

Calculate the average basket per customer

Only aggregate orders that are actually paid.

Level : IntermediateView SQL Essentials
Subquery · AVGSQL Essentials

Compare to average price

Use an aggregated value as a dynamic threshold.

Level : IntermediateView SQL Essentials
UNIONSQL Essentials

Merge customers and prospects

Create a single list from two compatible sources.

Level : IntermediateView SQL Essentials
UNION ALLSQL Essentials

Keep origin with UNION ALL

Stack two lists without losing traceability.

Level : IntermediateView SQL Essentials
INTERSECTSQL Essentials

Find the intersection of two lists

Keep only the values present in both sets.

Level : IntermediateView SQL Essentials
SELF JOINSQL Essentials

Connect a table to itself

Represent a simple hierarchy with two aliases.

Level : IntermediateView SQL Essentials
JOIN · GROUP BYSQL Essentials

Calculate revenue using three tables

Follow the keys without adding a measure twice.

Level : IntermediateView SQL Essentials
CASE WHENSQL Essentials

Classify inventory risk

Transform operational thresholds into readable categories.

Level : IntermediateView SQL Essentials
NULL · COUNTSQL Essentials

Measure phone completeness

Produce a quality rate from explicit volumes.

Level : IntermediateView SQL Essentials
Quality · HAVINGSQL Essentials

Detect duplicate emails

Transform a uniqueness constraint into measurable control.

Level : IntermediateView SQL Essentials
Quality · SubqueriesSQL Essentials

Reconcile orders and payments

Compare two independent totals in a single control line.

Level : IntermediateView SQL Essentials
CTE · CalculationsSQL Essentials

Calculate the overall margin with a CTE

Separate basic measurements and derived indicators.

Level : IntermediateView SQL Essentials
CTE · TOP NSQL Essentials

Rank the top three categories

Prepare a reliable aggregate before limiting the ranking.

Level : IntermediateView SQL Essentials
CASE · AggregationsSQL Essentials

Calculate multiple statuses in one line

Build conditional indicators without multiplying queries.

Level : IntermediateView SQL Essentials
AVG · HAVINGSQL Essentials

Filter an average basket with HAVING

Apply a threshold on an aggregated indicator.

Level : IntermediateView SQL Essentials
MIN · GROUP BYSQL Essentials

Find the first order

Bring back a history to its first date per customer.

Level : IntermediateView SQL Essentials
CTE · Auto-joinSQL Essentials

Compare each month to the previous one

Align two periods to calculate an absolute evolution.

Level : IntermediateView SQL Essentials
Project · joinsSQL Essentials

Calculate margin by category

Distinguish between revenue, cost and margin on paid lines.

Level : IntermediateView SQL Essentials
Project · KPISQL Essentials

Track monthly payment rate

Combine timing and conditional aggregation into one monitorable indicator.

Level : IntermediateView SQL Essentials
WHERE · ORDER BYNo account

Filter then sort a threshold

Keep the threshold inclusive and make the outcome controllable.

Level : BeginnerOpen exercise
IN · ORDER BYDiscovery space

Select multiple brands

Express a closed list without repeating multiple OR.

Level : BeginnerCreate a free account
Expressions · AliasesDiscovery space

Calculate a unit margin

Create a simple indicator from two compatible columns.

Level : BeginnerCreate a free account
Text · LENGTHDiscovery space

Control the length of names

Measure text before exporting to a limited size.

Level : BeginnerCreate a free account
3 exercises are available without an account, followed by 12 more in the free Discovery space. SQL Essentials unlocks all 44 exercises. Run a first query.