Solving LeetCode SQL Question with Explanation | LeetCode 184

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 also 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 used a slightly similar approach by first getting the Department ID and the Maximum Salary corresponding to it, then Filtering on Join using IN clause.


WITH temp
AS (SELECT departmentid,
Max(salary) AS salary
FROM employee
GROUP BY departmentid)

SELECT D.NAME AS Department,
E.NAME AS 'Employee',
E.salary AS 'Salary'
FROM employee E
LEFT OUTER JOIN department D
ON E.departmentid = D.id
WHERE ( salary, departmentid ) IN (SELECT salary,
departmentid
FROM temp);

rajattalnikar