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
What is the difference between the export /import functions in sql studio and standalone sql manager? : sql server management studio
what is the primary use of the model database? : Sql server administration
What is an identity column in insert statements?
What do you think of this implementation? Can this be implemented better?
What is master database? : SQL Server Architecture
What are constraints in microsoft sql server?
Where is my database stored on the hard disk in ms sql server?
What are horizontal and vertical scaling?
What is logon trigger?
how do you implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql server database administration
Does a specific recovery model need to be used for a replicated database? : sql server replication
Define msdb database?
Indexes are updated automatically is the full-text index also updated automatically?
Do you know spatial data types - geometry and geography in sql server 2008?
What is the order in which the sql query is executed?