sql query to find second largest salary dens_rank
#sql-query-to-find-second-largest-salary #largest-salary #sql-query #sql #Article
This is Question is most use full in Sql interview ,Below is Employee Table and we are going to write Sql Query using Dense rank function that is windowing function :
Name |
age | salary | department |
shubham mishra | 31 | 20000 | computer |
rahul kumar | 20 | 30000 | electric |
select Name , age , salary ,
dens_rank over (partition by department order by salary desc ) as rank
from
Employee
where rank =2
This Solution is provided by Shubham mishra This article is contributed by Developer Indian team. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. Also folllow our instagram , linkedIn , Facebook , twiter account for more