1070. Product Sales Analysis III - LeetCode SQL Solution [MySQL]

preview_player
Показать описание
Today I solve and explain a medium level difficulty leetcode SQL problem using MySQL called "1070. Product Sales Analysis III"

If you found this helpful Like and Subscribe! I solve LeetCode Algorithms and SQL Problems daily!

#leetcode #mysql #sql #tutorial #SQLinterviewQuestions #LeetCodeSQL #FAANG #coding #programming
Рекомендации по теме
Комментарии
Автор

SELECT product_id, first_year, quantity, price
FROM (
SELECT
s.product_id,
s.year AS first_year,
s.quantity,
s.price,
ROW_NUMBER() OVER (PARTITION BY s.product_id ORDER BY s.year) AS row_rank
FROM Sales s
) sub
WHERE row_rank = 1;

why not this?

asdfg
welcome to shbcf.ru