how to find the second highest salary from emp table?
Answers were Sorted based on User's Feedback
Answer / chandan
select slary from emp order by slary desc limit 1,1;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / parvezkhan pathan
select max(salary) from emp where salary not in(select
max(salary) from emp);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sai
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / praveen
SELECT MAX(Salary) as 'Salary' from EmployeeDetails
where Salary NOT IN
(
SELECT TOP 1 (SALARY) from EmployeeDetails ORDER BY Salary Desc
)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pankaj kumar
SELECT filedname
FROM tablename
ORDER BY fieldname DESC
LIMIT 2 , 1
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nitin
select max(salary) from emp where salary<>(select
max(salary) from emp);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chiru
select distinct sal from emp e where 2=(select
count(distinct sal) from emp where e1.sal>e.sal) order by
sal desc;
| Is This Answer Correct ? | 0 Yes | 0 No |
What is pl sql and why it is used for?
What is the use of non clustered index?
What is raid? How does it help storage of databases?
Explain sql data types?
Why do we use function in pl sql?
Which nosql database is best?
Can %notfound return null after a fetch?
What is the mutating table and constraining table?
Are stored procedures faster than dynamic sql?
What is dml statement?
what is the difference between truncate and delete statement? : Transact sql
What is composite primary key in sql?
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)