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 memory-optimized nonclustered indexes

1021


Explain about remote stored procedure?

1014


What is dirty page?

978


How to change the ownership of a schema in ms sql server?

1199


How do I create a trace in sql server?

1050


What happens if you insert a duplicate key for the primary key column in ms sql server?

983


What is the cartesian product of table?

1016


Which sql server table is used to hold the stored procedure scripts?

1070


Do you know what is replace and stuff function in sql server?

1023


What is tablix?

165


Does partitioning improve performance?

982


How can you hide the sql server instances?

1025


What is the impact on other user sessions when creating indexes?

927


What are “lost updates”?

1007


How to check parameter value in stored procedure sql server?

980