By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| version |
|---|
| PostgreSQL 9.6.23 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit |
6 rows affected
| item | year | price |
|---|---|---|
| Hat | 2020 | 15 |
| Hat | 2021 | 17 |
| Hat | 2022 | 19 |
| Pen | 2020 | 3 |
| Pen | 2021 | 2 |
| Pen | 2022 | 3.3 |
6 rows affected
2 rows affected
4 rows affected
6 rows affected
| item | price | year | prev_year | prev_price | higher_than_previous_year |
|---|---|---|---|---|---|
| Hat | 15 | 2020 | null | null | null |
| Hat | 17 | 2021 | 2020 | 15 | yes |
| Hat | 19 | 2022 | 2021 | 17 | yes |
| Pen | 3 | 2020 | null | null | null |
| Pen | 2 | 2021 | 2020 | 3 | No |
| Pen | 3.3 | 2022 | 2021 | 2 | yes |