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

Given an employee table, how would you find out the second
highest salary?

Answer Posted / karna

select top 1 a.salary,* from emp a
where a.salary not in(select top (n-1) b.salary from emp b)

here n is the Nth values:if you want secong highest: keep n
as 2 so the query will become

select top 1 a.salary,* from emp a
where a.salary not in(select top 1 b.salary from emp b)

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can an extended stored procedure be called from inside a user-defined function?

1066


Which four data types cannot be used as a return type from a user-defined function?

1028


You are testing the performance of a query the first time you run the query, the performance is slow. the second time you run the query, the performance is fast. why is this?

968


How to use online Backups?

2206


Explain about query and reporting.

2097


How can you fix a poorly performing query?

1194


What is data modeling with example?

1004


What are the key features of dbms?

997


Explain about normal forms?

1059


Explain what a database is?

1052


explain detail about ftp in datastage?

2248


Explain about network model?

1010


What is dbms and its application?

1009


What is an application role and explain a scenario when you would use one?

1012


What are the constraints on severity level in raiseerror?

989