-- @param {String} $1:regionCode
-- @param {DateTime} $2:startDate
-- @param {DateTime} $3:endDate
SELECT
  w.week AS timestamp,
  w.avg_price AS price_mwh,
  w.avg_demand AS demand_mw,
  r.code AS region_code,
  r.name AS region_name
FROM electricity_prices_weekly w
JOIN grid_regions r ON w.region_id = r.id
WHERE r.code = $1
  AND w.week BETWEEN $2 AND $3
ORDER BY w.week ASC
