Write a SQL query to identify peak power generation intervals across multiple wind farms at Nextera Energy Resources, ranking them by daily output.
Use the provided wind farm and generation interval data. Return only the highest-output interval for each farm on each date. If intervals tie, select the earliest interval.
farm_id, farm_name, generation_date, peak_interval_start, peak_output_mwh, daily_output_mwh, and daily_rankgeneration_date, daily_rank, and farm_id| Column | Type | Description |
|---|---|---|
| farm_idPK | INT | Unique identifier for the wind farm |
| farm_name | VARCHAR(100) | Name of the wind farm |
| region | VARCHAR(60) | Operating region of the wind farm |
| Column | Type | Description |
|---|---|---|
| interval_idPK | INT | Unique identifier for the generation interval |
| farm_id | INT | Referenced wind farm identifier |
| interval_start | TIMESTAMP | Start timestamp of the generation interval |
| generated_mwh | DECIMAL(12,2) | Energy generated during the interval in megawatt-hours |