LeetCode 607 Amazon 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
Рекомендации по теме
Комментарии
Автор

i was directly using joins and and a where filter and it did not click me that one salespoerson can have multiple order and if even one order was of company red I needed to exclude it, hence this won't work and it is better to get list of red orders and then filter them

mickyman
Автор

We can also write the query Instead of doing all that kind of stuff as -->select name from SalesPerson where sales_id not in(
select sales_id from Orders
where com_id=(select com_id from Company where name like 'RED'))

archnabhalerao
Автор

# Write your MySQL query statement below

select name
from SalesPerson
where sales_id not in (select sales_id
from Orders
where com_id = (select com_id from Company where name = 'RED'))

sanketarekar
Автор

why we are not getting right answer when we neglect all name = 'Red' in cte and then compare with salesperson table?

pritamm
Автор

why this is wrong
select name
from SalesPerson where sales_id NOT IN (select sales_id
from orders where com_id = 1)

parthbihani
Автор

select name from salesperson
where sales_id not in (
select distinct sales_id from orders
where com_id = (select com_id from company where name = "RED")
)

neerajkumawat
Автор

sir, i often get confused to take which table on left while doing left join . initially i was taking company on left side cause based on company we r filtering !! please on it.

PIYUSH-lzzq
Автор

select sum(orangecount) orangecount, sum(applecount) applecount from (select chestid, orangecount, applecount from box
union
select chestid, orangecount, applecount from chest) a

mohdzuhaib-rm
Автор

This solution is not working in my Leetcode.

seematiwari