.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

How To Get TOP 2 Salary From Salary Table

Posted By :Mallikarjuna Chigicherla     Posted Date :August 03, 2010    Points :10   Category :Sql Server 
SELECT TOP (2) Salary
FROM Salary
ORDER BY Salary DESC

You can also find related Interview Question to How To Get TOP 2 Salary From Salary Table  below: 

If you 1Lakh records of employee in a table, then how will you get the 4th highest salary from the table?

  
SELECT TOP 1 * FROM [EmpTable] WHERE [salary] NOT IN (SELECT DISTINCT TOP 3 salary FROM [temp1] ORDER BY [salary] DESC) ORDER BY salary DESC (More...)

How to find out Second highest salary from a table?

  
select max(salary) from emp where salary not in(select max(salary) from emp) (More...)

How do retrieve the third lowest salary from salary table?

  

SELECT salary_amount
FROM (select salary2.*, rownum rnum from
(select * from salary ORDER BY salary_amount) salary2
where rownum <= 3 )
WHERE rnum >= 3;
(More...)

What is the query to get second higest salary of Employee table?

  
select MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary) from Employee ); (More...)

Findout Top 2 Highest Salary By Using sql query?

  
Select Top(2) Salary from Table name Where order By Salary Desc (More...)

How to find out 3rd Highest Salary?

  
Select Min(Salary) As Salary from Tablename where Salary In(Select
distinct top 3 salary from tablename order by salary desc) (More...)

Write a query to get the second maximum salary using Sql Server 2005 function?

  

SELECT Salary
FROM (
SELECT Salary, RANK() OVER (ORDER BY Salary DESC) AS MaxSalary
FROM dbo.Employee
) a
WHERE MaxSalary = 2
(More...)

Write Query to get nth Highest Salary in SQL Server

  
Select TOP 1 Salary as
from (SELECT DISTINCT TOP nth Salary from Employee ORDER BY Salary DESC)
a ORDER BY Salary ASC (More...)

Write Query to get nth Lowest Salary in SQL Server

  
Select TOP 1 Salary as
from (SELECT DISTINCT TOP n Salary from Employee ORDER BY Salary ASC)
a ORDER BY Salary DESC (More...)

What are the privileges that can be granted on a table by a user to others?

  
Insert, update, delete, select, references, index, execute, alter, all (More...)

What command is used to create a table by copying the structure of another table?

  
CREATE TABLE .. AS SELECT command

Explanation :

To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend