By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 6
| id | extra | jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | abc | 25 | 20 | null | null | null | null | null | null | null | null | null | null |
| 2 | def | 10 | 5 | null | null | null | null | null | null | null | null | null | null |
| 3 | ghi | null | null | 15 | null | null | null | null | null | null | null | null | null |
SELECT 3
| id | extra | jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | abc | 25 | 20 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2 | def | 10 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 3 | ghi | 0 | 0 | 15 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
SELECT 3
| id | extra | jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | abc | 25 | 20 | null | null | null | null | null | null | null | null | null | null |
| 2 | def | 10 | 5 | null | null | null | null | null | null | null | null | null | null |
| 3 | ghi | null | null | 15 | null | null | null | null | null | null | null | null | null |
SELECT 3