from the table display the 2nd highest salary?
and also the least 2nd salay?
Answer Posted / prasanthi
Query for Getting 2nd least salary (replace 2 with any
number so that you will get any least salary:
select max(Salary) from Employee
where Salary in
(select distinct top 2 Salary from dbo.Employee order by
Salary asc)
Query for Getting 2nd Height salary (replace 2 with any
number so that you will get any least salary:
select min(Salary) from Employee
where Salary in
(select distinct top 2 Salary from dbo.Employee order by
Employee desc)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
In what three ways is the return statement used in a stored procedure?
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
How can you start sql server in different modes?
what happens on checkpoint? : Sql server database administration
Can we insert data if clustered index is disabled?
What is a linked server in sql server?
What does it mean to manipulate data?
Stored Procedure returns data from multiple tables. How to access it in your ASP.Net code?
How do I completely remove sql server instance?
What is the difference between char, varchar and nvarchar?
How to update a field in SQL after ALTERING a row?
What is the difference between ‘having’ clause and a ‘where’ clause?
What method is used by the Command classes to execute SQL statements that return single values?
What is a file group?
Explain the steps to create and execute a user-defined function in the sql server?