BOX8 | Ranking in SQL
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answers ( 4 )
with cte as (
Select department, salary, , rank () over (partition by department order by salary asc ) as Min_Sal
from Table
)
Select * from cte
where min_sal=1
select empname from employeeswhere empname = (select empname,
min(sal) from employees
group by department)
select name, department, rank() over(partition by department order by salary asc) as sal_rank
from table
where sal_rank =1;
SELECT Name FROM
(SELECT Name , MIN(Salary) from table GROUP BY Department)