LeetCode Medium 1715 Interview SQL Question with Detailed Explanation

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

In this video I solve and explain a medium difficulty 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
Рекомендации по теме
Комментарии
Автор

Sir, Thanks a lot for This Amazing Video 😊
Problem - 72 Solved ✅ in Practice SQL - LeetCode 👩🏻‍💻

PrithaMajumder
Автор

with cte as (select Boxes.chest_id, Chests.apple_count, Chests.orange_count
from Boxes
left join Chests on Boxes.chest_id=Chests.chest_id),
bte as(select apple_count, orange_count from cte
union all
select apple_count, orange_count from Boxes)
select sum(apple_count) as apple_count, sum(orange_count) as orange_count from bte;

maheshwaroli
Автор

select
sum(b.apple_c+coalesce(c.apple_c, 0))
as app
, sum(b.orange_c + coalesce(c.orange_c, 0)) as oran
from boxes b
left join chest c
on b.chest_id = c.chest_id

meenayegan
Автор

select
sum(boxes.apple_count + COALESCE(Chests.apple_count, 0)) as apple_count,
sum(boxes.orange_count + COALESCE(Chests.orange_count, 0)) as orange_count
from boxes left join Chests
on boxes.chest_id = chests.chest_id

k_aryal
Автор

SELECT
SUM(b.apple_count + COALESCE(c.apple_count, 0)) AS apple_count,
SUM(b.orange_count + COALESCE(c.orange_count, 0)) AS orange_count
FROM
Boxes b
LEFT JOIN
Chests c ON b.chest_id = c.chest_id;

mickyman
Автор

Thank you for the video and i hope in the future you will make videos on hard questions on leetcode!

florincopaci
Автор

select
s1.sale_date,
s1.sold_num - s2.sold_num as diff
from
sales s1
inner join sales s2
on s1.sale_date = s2.sale_date
where s1.fruit = 'apples' and s2.fruit = 'oranges';

tejaswaniguttula