Product Sales Analysis III
Task: Write a solution to select the product id, year, quantity, and price for the first year of every product sold.
Table: Sales
+-------------+------+
| Column Name | Type |
+-------------+------+
| sale_id | INT |
| product_id | INT |
| year | INT |
| quantity | INT |
| price | INT |
+-------------+------+
Input: Sales table:
+---------+------------+------+----------+-------+
| sale_id | product_id | year | quantity | price |
+---------+------------+------+----------+-------+
| 1 | 100 | 2008 | 10 | 5000 |
| 2 | 100 | 2009 | 12 | 5000 |
| 7 | 200 | 2011 | 15 | 9000 |
+---------+------------+------+----------+-------+
Output:
+------------+------------+----------+-------+
| product_id | first_year | quantity | price |
+------------+------------+----------+-------+
| 100 | 2008 | 10 | 5000 |
| 200 | 2011 | 15 | 9000 |
+------------+------------+----------+-------+