Interview Question 21 Nth Highest Salary Multiple Solutions
Watch my YouTube video for explanation :
Please look into the class notes here for your references:
Get the employee getting Nth highest salary? provide multiple solutions.
1. Using dense_rank analytical function in sql
2. using sub query
3. using scan component in abinitio
sol1
with T as
( select *, dense_rank() over(order by sal desc) as RANK from employee
)
select name, salary from T where RANK=N
Sol2
select name, salary from employee A
where N-1 = (select count(1) from employee B where B.salary>A.salary)
sol3
scan , Assign Rank Flag and Filter in output_select function
Fore more Abinitio, AWS and data engineering videos please subscribe , view , like and share my YouTube channel
Click DataPundit
Comments
Post a Comment