Your question is Aggregate Daily Returns Query. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Aqr's portfolio tracking system stores portfolio metadata separately from daily return observations. Write a PostgreSQL query that summarizes active portfolios between 2025-01-01 and 2025-01-03.
| Column | Type | Description |
|---|---|---|
| portfolio_idPK | INT | Unique portfolio identifier |
| portfolio_name | VARCHAR(100) | Aqr portfolio name |
| portfolio_type | VARCHAR(50) | Portfolio strategy classification |
| is_active | BOOLEAN | Whether the portfolio is currently active |
| Column | Type | Description |
|---|---|---|
| observation_idPK | INT | Unique return observation identifier |
| portfolio_id | INT | Portfolio associated with the observation |
| return_date | DATE | Date of the return observation |
| return_pct | DECIMAL(10,6) | Return percentage for the observation |