1164. Product Price at a Given Date
Description
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| product\_id | int |
| new\_price | int |
| change\_date | date |
+---------------+---------+
(product\_id, change\_date) is the primary key of this table.
Each row of this table indicates that the price of some product was changed to a new price at some date.Products table:
+------------+-----------+-------------+
| product\_id | new\_price | change\_date |
+------------+-----------+-------------+
| 1 | 20 | 2019-08-14 |
| 2 | 50 | 2019-08-14 |
| 1 | 30 | 2019-08-15 |
| 1 | 35 | 2019-08-16 |
| 2 | 65 | 2019-08-17 |
| 3 | 20 | 2019-08-18 |
+------------+-----------+-------------+
Result table:
+------------+-------+
| product\_id | price |
+------------+-------+
| 2 | 50 |
| 1 | 35 |
| 3 | 10 |
+------------+-------+ac
Last updated