how to find the second highest salary from emp table?
Answer Posted / bharath reddy
These qeries give you second higest salary
select e.sal from emp e,emp d where d.sal>e.sal
group by e.sal
having count(e.sal)=2
;
SAL
-----
3000
(or)
select distinct e.sal from emp e where (select count(sal)
from emp d where d.sal>e.sal)=1;
SAL
-----
3000
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the use of stored procedures?
Which is better trigger or stored procedure?
What is anonymous block in sql?
What plvcmt and plvrb does in pl/sql?
What is pivot in sql?
What is a sql trace file?
What do you understand by case manipulation functions?
How do you rename a table in sql?
Explain the difference between rename and alias?
Can we use ddl statements in stored procedure?
Which version of sql do I have?
What is data modelling in sql?
What is graph sql?
what is a composite key ? : Sql dba
What information is needed to connect sql*plus an oracle server?