.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

Write Query to get nth Lowest Salary in SQL Server

Posted By :volvo     Posted Date :November 21, 2013    Points :40   Category :Sql Server 
Select TOP 1 Salary as
from (SELECT DISTINCT TOP n Salary from Employee ORDER BY Salary ASC)
a ORDER BY Salary DESC

You can also find related Interview Question to Write Query to get nth Lowest Salary in SQL Server  below: 

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

What is 'Write-ahead log' in Sql Server 2000 ?

  
Before understanding it we must have an idea about the transaction log files. These files are the files which holds the data for change in database .
Now we explain when we are doing some Sql Server 2000 query or any Sql query like Sql insert query,delete sql query,update sql query and change the data in sql server database it cannot change the database directly to table .Sql server extracts the data that is modified by sql server 2000 query or by sql query and places it in memory.Once data is stores in memory user can make changes to that a log file is gernated this log file is gernated in every five mintues of transaction is done. After this sql server writes changes to database with the help of transaction log files. This is called Write-ahead log. (More...)

Findout Top 2 Highest Salary By Using sql query?

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

Write a query to Select top 2 Highest salaries?

  
select Top(2) salary from Tablename order by Salary desc.... (More...)

Write a SQL query to send mail, whenever a new record is inserted into a table using Sqlserver 2000.

  
Here we have to create a trigger on required table as show below.


CREATE TRIGGER SendRem
ON TableX
AFTER INSERT
AS

EXEC master..xp_sendmail
@recipients='you@you.com',
@message = 'body'
@subject = 'foo was fired.'
GO
(More...)

Which command using Query Analyzer will give you the version of SQL server and operating system?

  
SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition'). (More...)

How to find out server name using query

  


SELECT @@SERVERNAME as Server Name


The results look like the following:

Server Name
---------------------------------
Server1 (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...)

Which command using Query Analyzer will give you the version of SQL server and operating system?

  
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY
('edition') (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