Medium
SQL-J06sql3-Table Revenue Per Region
Problem
Join `regions(id,name)`, `customers(id, region_id)`, `orders(id, customer_id, amount)` to produce total revenue per region. Include regions with zero revenue (output 0).
Input
Three tables.
Output
region_name, revenue
Constraints
1 ≤ rows ≤ 10^6
Sample input
see prompt
Sample output
APAC | 1280 EMEA | 0
Explanation
LEFT JOIN customers + orders to keep regions with no customers/orders.
joinsleft-joinaggregation@Amazon
Visible test cases
in: see
out: regions
Your solution — run it, use AI if stuck
sql
