Back Practice ↓

Related Practice & In-Depth Concepts

↑ Read lesson

Task:The CEO wants to find our 'Whale' customers. A Whale is defined as a user whose total lifetime spending is greater than $150. Use a CTE named `user_spending` to calculate the total amount spent by each user (`user_id`, `lifetime_spend`). Then, write a main query that joins this CTE back to the `users` table to return the `name` of the user and their `lifetime_spend`, filtering ONLY for those where `lifetime_spend > 150`.
SQL Query Editor
No results returned. Press Run Query (or Cmd/Ctrl + Enter) to execute.