By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| version |
|---|
| PostgreSQL 14.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4), 64-bit |
| item | year | price | previous_year | previous_price | higher_than_previous_year |
|---|---|---|---|---|---|
| Hat | 2020 | 15 | null | null | null |
| Hat | 2021 | 17 | 2020 | 15 | Yes |
| Hat | 2022 | 19 | 2021 | 17 | Yes |
| Pen | 2021 | 2 | null | null | null |
| Pen | 2020 | 3 | 2021 | 2 | Yes |
| Pen | 2022 | 3.3 | 2020 | 3 | Yes |