Simple CTE for Readability
Medium
ctes
Google
Meta
Databricks
Write a query using a CTE to first calculate total spending per customer, then select customers who spent more than 300. Return customer_id and total_spent, ordered by total_spent DESC.
Expected Output: High-spending customers identified via CTE.
Tables
Hints (2 available)
SQL Editor
Output
Click "Run" to see results...