naive_fan_query.sql
SELECT
c.customer_name,
SUM(ol.quantity * ol.unit_price) AS order_total,
SUM(st.target_amount) AS sales_target_total
FROM customers AS c
JOIN orders AS o
ON o.customer_id = c.customer_id
JOIN order_lines AS ol
ON ol.order_id = o.order_id
JOIN sales_targets AS st
ON st.customer_id = c.customer_id
GROUP BY c.customer_id, c.customer_name;