Sequence NODE_290
Medium

Calculate Total Revenue Per User

SQL
Technical Specification

Using users and orders tables, compute total revenue per user and show only users with revenue > 1000.

Input/Output Samples
Input:orders + users
Output:{ user_id, total_revenue > 1000 }
Optimal Logic Path
SELECT 
  u.id,
  u.name,
  SUM(o.total_amount) AS total_revenue
FROM users u
JOIN orders o ON o.user_id = u.id
GROUP BY u.id, u.name
HAVING SUM(o.total_amount) > 1000;
Architectural Deep-Dive
We join and aggregate monetary values to find high-value customers.