Enverus Prism analysts need a basin-level view of active well performance. Write a PostgreSQL query that aggregates 2024 oil production, ranks wells within each basin, and calculates a running basin total.
Requirements
- Include only wells whose status is
active and whose basin is not null.
- Aggregate oil production from
production_monthly for calendar year 2024, retaining active wells with no matching production.
- Rank wells within each basin by total oil production in descending order. Wells with equal totals must receive the same rank.
- Calculate a cumulative oil total within each basin, ordered by total production descending and then
well_id.