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


Please Help Members By Posting Answers For Below Questions

How to replace the Query Result 'Null Value' with a text ?

562


How can you insert values in multiple rows using one Insert statement?

615


What Is Rdbms?

672


Comment,Datatypes are unlimited

1624


explain how to create a new schema in a database? : Sql server database administration

578






How to receive output values from stored procedures?

479


What is the use of =,==,=== operators?

575


what is a deadlock? : Sql server database administration

493


How do you maintain database integrity where deletions from one table will automatically cause deletions in another table?

709


Explain how you can deploy an SSRS report?

106


Explain important index characteristics?

553


What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?

475


What is cursors?

636


What does Master database contains?

626


What is scrollable cursor?

539