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 |
Difference between a query and strored procedure?
What is the relation b/w view and trigger
what is sql server agent? : Sql dba
How do I kill a query in postgresql?
What is dml statement?
What is data type in sql?
How do I write a sql query in pgadmin 4?
Can we insert data into materialized view?
What is PL/SQL table ?
what is an index? : Sql dba
how to add a new column to an existing table in mysql? : Sql dba
describe transaction-safe table types in mysql : sql dba
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)