Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is the difference between the export /import functions in sql studio and standalone sql manager? : sql server management studio

1122


what is the primary use of the model database? : Sql server administration

1024


What is an identity column in insert statements?

1003


What do you think of this implementation? Can this be implemented better?

918


What is master database? : SQL Server Architecture

998


What are constraints in microsoft sql server?

1099


Where is my database stored on the hard disk in ms sql server?

1040


What are horizontal and vertical scaling?

170


What is logon trigger?

1069


how do you implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql server database administration

1042


Does a specific recovery model need to be used for a replicated database? : sql server replication

943


Define msdb database?

1001


Indexes are updated automatically is the full-text index also updated automatically?

1002


Do you know spatial data types - geometry and geography in sql server 2008?

1006


What is the order in which the sql query is executed?

924