SELECT user_id, SUM(revenue) AS total_rev, RANK() OVER (ORDER BY total_rev DESC) FROM transactions WHERE created_at >= '2024-01-01' GROUP BY 1
SQL for Analytics
Go beyond basic queries. Master window functions, CTEs, subqueries, and query optimization — the SQL toolkit every analyst needs on the job.