LeetCode Medium 177 'Nth Highest Salary' Amazon Bloomberg Interview SQL Question With 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
Рекомендации по теме
Комментарии
Автор

man you are wonderful. You are the only I guy I have seen that writes FROM before SELECT, which is how it should be

jeroldmorphy
Автор

Alternative if interviewer ask to not to use windows functions:


CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
SET N = N-1;
RETURN (
# Write your MySQL query statement below.
select
distinct salary
from Employee
order by salary desc
limit 1 offset N

);
END

devsagar
Автор

can you explain why u write in code where rnk = n

needoa