SQL Server Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 529 Page Views: 

Give the query to get the 4th highest salary from emp table.



Posted By: Avi Date: 1 October 2010 12:10:08 PM
 Answer:

SELECT TOP 1 salary FROM ( SELECT DISTINCT TOP 4 salary FROM emp ORDER BY salary DESC) a ORDER BY salary


Posted By: avibtech


Date: 1 October 2010 12:10:08 PM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image YTHs4N
Related Questions
SQL Server : What is the difference between VARCHAR and NVARCHAR type?

What is the difference between VARCHAR and NVARCHAR type?

VARCHAR is a variable length string of ASCII characters while NVARCHAR is a variable length string o....
Category: SQL Server Date: 10/7/2009 3:09:18 AM
SQL Server : What is SQL injection attack?

What is SQL injection attack?

SQL injection is an attack in which malicious code is inserted into strings that are later passed to....
Category: SQL Server Date: 10/2/2009 7:12:03 AM
SQL Server : Why we use SET ROWCOUNT statement in SQL Server?

Why we use SET ROWCOUNT statement in SQL Server?

It causes SQL Server to stop processing the query after the specified number of rows (e.g. SET ROWCO....
Category: SQL Server Date: 10/2/2009 7:03:39 AM
SQL Server : How can we delete the duplicate rows from a  table?

How can we delete the duplicate rows from a table?

Lets consider if we have a table Employee with rowid, name and email columns. Then we can use follow....
Category: SQL Server Date: 9/19/2009 4:58:46 AM
SQL Server : How can we find the number of rows in a table?

How can we find the number of rows in a table?

Following SQL statements can be used to get the number of rows in a table: SQL Query - 1: SELECT CO....
Category: SQL Server Date: 9/19/2009 4:51:20 AM