LeetCode 1795 Interview SQL Question with Detailed Explanation | Practice SQL

preview_player
Показать описание

In this video I solve and explain a leetcode SQL question using MySQL query. This question has been asked in Apple, Facebook, Amazon, Google, Adobe, Microsoft, Adobe interviews or what we popularly call FAANG interviews.
I explain the related concept as well. This question includes points to keep in mind to develop SQL queries.

LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews.

If you found this helpful, Like and Subscribe to the channel for more content.

#LeetCodeSQL #FAANG #SQLinterviewQuestions
Рекомендации по теме
Комментарии
Автор

Its very helpful for by step explanation is great..thanku

sathiroy
Автор

very beautiful explaination... Thank you :)

ajlalkhan
Автор

it was really helpful thanks for uploading...

alphonseprakash
Автор

This question is listed as easy on LeetCode even tho it was asked in Amazon ? hehe something doesnt sound right, i completly didint understand how to complete this one and even when i looked up the solutions i was confused why was store1 in a string but u explain everything, you are awesome, i will come back to this video coz im still not a 100% on this one

DisturbeD
Автор

with cte as ( select product_id, store, price from ( SELECT product_id, store1, store2, store3 FROM Products) AS product_i
UNPIVOT
(Price FOR Store IN
(store1, store2, store3)) AS Sales)

select product_id, store, price from cte where price is not null

shashankreddy
Автор

my way which works but isn't ideal to do this way:
select * from
(with cte as(
SELECT * FROM products
CROSS JOIN
( SELECT 'store1' AS name, 1 as ranks UNION ALL SELECT 'store2', 2 UNION ALL SELECT 'store3', 3 )
AS temp)
select product_id, name as store, case when ranks=1 then store1 when ranks=2 then store2 else store3 end
as price from cte) x
where x.price is not null;

mickyman
Автор

is it the best way to solve this question?

atishay-jain