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 |
Why we are using the sql language?. What is the purpose of using this?
Why use triggers?
List the advantages of using stored procedures?
Explain about merge replications?
What is triggers and stored procedures?
How can we delete Duplicate row in table?
How to connect to a sql server using odbc_connect()?
what purpose does the model database serve? : Sql server database administration
What command is used to rename the database?
What is the default server name for sql server?
What are the different types of backups avaialabe in sql server 2005?
What are the new features in sql server 2016?
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)