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