sqlbeginner10 minutes

Find Customers Who Made Purchases Above $100 Using SQL

Practice writing a SQL query to identify customers who have made purchases greater than $100 from a sales table.

Challenge prompt

Given a table named 'Sales' with columns 'CustomerID', 'PurchaseDate', and 'Amount', write a SQL query to find all unique customers who have made any purchase with an amount greater than 100. Return the CustomerID values without duplicates.

Guidance

  • Use the WHERE clause to filter purchases with Amount greater than 100.
  • Use SELECT DISTINCT to get unique CustomerID values without duplicates.
  • Make sure the output contains only the CustomerID column.

Hints

  • Remember that DISTINCT helps to remove duplicate rows in the result.
  • You can write a simple WHERE condition like 'Amount > 100'.

Starter code

SELECT DISTINCT CustomerID
FROM Sales
WHERE 

Expected output

CustomerID ---------- 123 456 789

Core concepts

SELECT DISTINCTWHERE clauseFiltering data

Challenge a Friend

Send this duel to someone else and see if they can solve it.