SQLSQL
#38

Find Product Price as of a Target Date in SQL

MediumFlipkart
Interview Question #38
Asked at Flipkart

Given a `products` table (product_id, new_price, change_date), find the price of all distinct products on '2026-08-16'. Assume all products had an initial base price of 10 before any price change.

Input Table: products
5 rows preview
product_idnew_pricechange_date
1202026-08-14
2502026-08-14
1302026-08-15
1352026-08-18
3302026-08-17
Expected Output Structure3 rows
product_idprice
130
250
310
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us