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 wide table?

906


What it means to be triggered?

939


Can we call stored procedure in view in sql server?

875


What is the Disadvantage of indexed sequential file.

1044


What are sql server functions?

951


what is normalization? Explain different levels of normalization? : Sql server database administration

1249


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

997


What are commit and rollback in sql?

1081


How do I install only the client tools of sql server 2000?

1017


what is denormalization? : Sql server database administration

892


What are the advantages dts has over bcp?

962


Explain log shipping and mention its advantages.

1000


How to create a new login name in ms sql server?

1017


What is truncate table?

911


What is instead of dml trigger?

966