from the table display the 2nd highest salary?
and also the least 2nd salay?
Answer Posted / bobby
select p.emp_id,p.name,p.salary from
(select emp_id,name,salary,dense_rank()over( order by
salary desc)maxrank,
dense_rank()over( order by salary asc)minrank from test)p
where maxrank=2 or minrank=2
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How to replace the Query Result 'Null Value' with a text ?
How can you insert values in multiple rows using one Insert statement?
What Is Rdbms?
Comment,Datatypes are unlimited
explain how to create a new schema in a database? : Sql server database administration
How to receive output values from stored procedures?
What is the use of =,==,=== operators?
what is a deadlock? : Sql server database administration
How do you maintain database integrity where deletions from one table will automatically cause deletions in another table?
Explain how you can deploy an SSRS report?
Explain important index characteristics?
What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?
What is cursors?
What does Master database contains?
What is scrollable cursor?