write query for fourth maximum salary from employee table
Answers were Sorted based on User's Feedback
Answer / anish tuladhar
select
distinct salary
from
(
select
DENSE_RANK() over(order by salary desc) as rnk,
salary
from
employee
) a
where
rnk = 4
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / prabhjeet singh sethi
select * from
(select rank(salary) over (partition by employee order by salary desc) as top_salary, employee from table
group by employee)
where top_salary = 4
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / icedrop
select top 1 salary from (select distinct top 4 Salary from tablename order by salary desc ) result order by salary
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / santhosh
;with result as
(
--use dense_rank instead of row_number or rank
select salary, DENSE_RANK() over (order by salary desc) as denserank
from Employees
)
select top 1 * from result
where denserank = 4
Is This Answer Correct ? | 0 Yes | 0 No |
I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL Server table. The info has to be joined together according to Record ID numbers. I have very limited access to the Oracle database but full control of the SQL Server database.How do I join two different queries from two different databases?
What does it mean to manipulate data?
Give me a SQL Query to find out the second largest company?
What is dbcc? Give few examples.
How m-m relationships are implemented?
How to delete particular value in the column of a table.Is it possible or not?if possible give it as in query.
How to include date and time values in sql statements?
Can we move Resource database from one path to another? If yes,How can we?
Explain query editor regions
What are the features of Embedded SQL
What is sql server query analyzer?
How to know whether our backup is succesfully taken?