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 |
logshipping is Any difference 2000 and 2005?
What is user stored procedure & it purpose?
What are the parts of a function?
Diffrences between sql server 2000 vs 2008
How many types of database relationship in sql server?
If i am handling 150 servers then how to check the active jobs of all the servers?
What are the purposes of floor and sign functions?
What is side by side migration in sql server?
What is the use of RDBMS?
1.what is the purpose of using alias name in sql server? with certain example? 2.what is cursor?will u plz explain me in detail with certain example?
Wht is the difference between stored procedure and trigger
plz tell me the new features of sqlserver2000,sqlserver2002,sqlserver2005
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)