By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| productID | deptID | Month | PrevYear | PrevPrice | CurrYear | CurrPrice |
|---|---|---|---|---|---|---|
| 1 | 10 | 1 | 2015 | 45 | 2016 | 12 |
| 1 | 10 | 2 | 2015 | 65 | 2016 | 46 |
| 1 | 10 | 3 | 2015 | 0 | 2016 | 77 |
| 2 | 11 | 1 | 2015 | 45 | 2016 | 88 |
| 2 | 11 | 2 | 2015 | 65 | 2016 | 0 |
| 2 | 11 | 3 | 2015 | 44 | 2016 | 0 |