How would you unpivot a given table from columns to rows?
Use the security_monthly_returns table. Convert the four monthly return columns into one row per security, date, and month, excluding missing monthly returns.
security_id, as_of_date, month, and return_value.security_id, as_of_date, and month in calendar order.| Column | Type | Description |
|---|---|---|
| security_id | VARCHAR(12) | Security identifier |
| as_of_date | DATE | Observation date |
| jan_return | NUMERIC(8,5) | January return |
| feb_return | NUMERIC(8,5) | February return |
| mar_return | NUMERIC(8,5) | March return |
| apr_return | NUMERIC(8,5) | April return |