Master SQL Date Logic & COALESCE | Don't Let NULLs Trap You! LeetCode 1164 SQL Solution Explained
Автор: Vivek The Analyst
Загружено: 2026-01-13
Просмотров: 22
Solving LeetCode 1164 using Correlated Subqueries and COALESCE.
In this video, we tackle LeetCode Medium problem 1164. Product Price at a Given Date. This is a common pattern in SQL interview questions where you need to find the state of a record (like a price) at a specific point in time.
We will learn how to handle scenarios where a product might not have a price change before the target date and needs a default value.
In this video, you will learn:
How to filter data based on specific date constraints (less than= '2019-08-16').
How to use a Correlated Subquery inside the SELECT clause to find the most recent price.
How to use the COALESCE() function to handle NULL values and set a default price of 10.
Grouping results by product_id effectively.
The Logic: We select the product ID and look for the latest price change that happened on or before our target date. If no price change exists found (returning NULL), we use COALESCE to default the price to 10.
#sqlinterview #leetcode #dataanalyst #ViveKtheAnalyst #sqlinterviewquestions #databaseconcepts
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: