Window function solution
\nselect product_id, year as first_year, quantity, price\nfrom(\nselect *,\nrank() over(partition by product_id order by year) as year_rnk\nfrom sales) as tbl\n
```\nselect product_id, year as first_year, quantity, price\nfrom(\nselect *,\nrank() over(partition by product_id order by year) as year_rnk\nfrom sales) as tbl\nwhere year_rnk = 1\n\n```
[]