From 09f813da44ad91e20c427d38e991995e943866cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Chac=C3=B3n=20Guti=C3=A9rrez?= <138903866+joseantoniochacon@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:32:30 -0600 Subject: [PATCH] Create README - LeetHub --- 1164-product-price-at-a-given-date/README.md | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 1164-product-price-at-a-given-date/README.md diff --git a/1164-product-price-at-a-given-date/README.md b/1164-product-price-at-a-given-date/README.md new file mode 100644 index 0000000..1719f64 --- /dev/null +++ b/1164-product-price-at-a-given-date/README.md @@ -0,0 +1,45 @@ +

1164. Product Price at a Given Date

Medium


SQL Schema

Table: Products

+ +
+---------------+---------+
+| Column Name   | Type    |
++---------------+---------+
+| product_id    | int     |
+| new_price     | int     |
+| change_date   | date    |
++---------------+---------+
+(product_id, change_date) is the primary key (combination of columns with unique values) of this table.
+Each row of this table indicates that the price of some product was changed to a new price at some date.
+ +

 

+ +

Write a solution to find the prices of all products on 2019-08-16. Assume the price of all products before any change is 10.

+ +

Return the result table in any order.

+ +

The result format is in the following example.

+ +

 

+

Example 1:

+ +
Input: 
+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  |
++------------+-----------+-------------+
+Output: 
++------------+-------+
+| product_id | price |
++------------+-------+
+| 2          | 50    |
+| 1          | 35    |
+| 3          | 10    |
++------------+-------+
+
+
\ No newline at end of file