How to get second highest salary from a table
Answers were Sorted based on User's Feedback
Answer / senthil
select max(sal) from emp where sal <(select max(sal) from emp)
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / srinivas
select * from emp m where(select count(distinct sal)+1 from emp s where s.sal>m.sal)=2
| Is This Answer Correct ? | 7 Yes | 3 No |
Answer / saiz
select min(salary)
from emp
where salary in ( select top 2 salary
from emp
order by salary desc);
| Is This Answer Correct ? | 3 Yes | 0 No |
Can a table have no primary key?
How to copy a table in another table with datas?
How to avoid using cursors?
What is data abstraction in sql?
What is meant by temporal data?
how can you create an empty table from an existing table? : Sql dba
what is subquery? : Sql dba
Whate is use of MOD function in pl/sql.
Can any one tell me how to increase the performance of a sql query ie what are the performance tips in creating or writing a sql query !!?
how will i became good database developer?
What are types of joins?
What are two virtual tables available during database trigger execution ?
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)