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

How to get the query of a table in sql server?

963


What are the requirements to use odbc connections in php scripts?

1157


What is inline table-value user-defined function?

1165


Explain raiserror in sql server?

1078


how can you attach more than 20 ldf files in sql server

2051


Tell me about joins in database system and explain each in detail.

1106


How to get all stored procedures in sql server?

1060


What are indexes in ms sql server?

1118


What are the new scripting capabilities of ssms? : sql server management studio

1120


what is difference between NULL and ISNULL in SQL Server 2008?

1058


How do I start sql server 2017?

986


How do we know if any query is retrieving a large amount of data or very little data?

1034


Do you know what is fill factor and pad index?

1047


What is table join?

1172


Explain the flow of creating a cube? : sql server analysis services, ssas

1102