how to calcuate the second highest salary of he employee
Answers were Sorted based on User's Feedback
Answer / shailesh
select sal from emp where sal=(select max(sal) from emp
where sal<(select max(sal) from emp);
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / jitendra
To get nth highest Salary, use below query
SELECT TOP 1 salary
FROM (
SELECT TOP nth salary
FROM Emp
ORDER BY salary DESC
) TmpTable
ORDER BY salary ASC
Replace nth with your number like second highest=2 4th=4 etc
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / vivek ghorad
select min(select top(2)salary from emp)from emp;
| Is This Answer Correct ? | 3 Yes | 9 No |
Is id a reserved word in sql?
What is data abstraction in sql?
What are the types of join in sql?
Types of joins?
What are the different sql languages?
What is the difference between explicit and implicit cursors in oracle?
Is it possible to link two groups inside a cross products after the cross products group has been created?
define a variable representing the expression used to calculate on emps total annual remuneration.use the variable in a statement which finds all emps who can earn 30000 a year or more.
Is it possible to update views?
How to start the command-line sql*plus?
Explain commit, rollback and savepoint.
what is hash join
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)