Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Customer activity
Finding good customers


Fantastic job! Let's do one more exercise.


Find the number of good customers (defined as those with an average order value greater than 1500.00) in weekly registration and city cohorts (i.e., cohorts defined by both weekly registration and the customer's city). Show the following columns: Year, Week, City, and GoodCustomers. Order the results by year and week.

Stuck? Here's a hint!

Inside the CTE, select CustomerID, RegistrationDate, City, and AVG(TotalAmount) based on the Customers and Orders tables. Introduce a HAVING clause.

Use this information in the outer query.