A recruitment company wants to monitor consultant placement activity over time. Write a PostgreSQL query that calculates a three-day rolling average of completed placements for each active consultant from January 1 through January 5, 2025.
Requirements
- Include every active consultant for every date in the requested range, including dates with zero completed placements.
- Count only placements whose
placement_status is completed.
- Use a window function partitioned by consultant and ordered by date. The rolling window must include the current date and the two preceding dates.
- Return results ordered by consultant ID and activity date, with the rolling average rounded to two decimal places.