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...

Find 2nd Highest salery in emp table

Select* from emp where &n=
select * count from emp where (salery >=emp.salery)


Enter n value 2


These query is correct or not. Tell me any other methods.

Answer Posted / madhu sudhan g

Hii lets consider the table Salary having EMPNO,EMPSal columns
to find the 2nd higest salary

;WITH CTE(Sal,Row)
AS
(
select EMPSal,ROW_NUMBER() OVER(ORDER BY EMPSal) as Row from Salary
)
select sal as Salary from CTE where Row=2

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is serializable?

995


Does a sql server 2005 select statement require a from?

970


how to use DTS package in 2000,2005,2008 in sql server

1786


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

962


Explain transaction server explicit transaction?

876


You want to implement the many-to-many relationship while designing tables. How would you do it?

955


Which Model uses the SET concept

933


What are the drawbacks of reporting in ssrs?

141


Does dbcc checkdb requires db to be in single_user mode? : sql server database administration

912


How can sql server instances be hidden?

893


Can you edit the .rdl code associated with a linked report?

149


How do you drop an index?

862


Can we use where and having clause together?

978


How can a database be repaired?

923


Explain the truncate command? : SQL Server Architecture

1092