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 set statement in tsql? : Transact sql
Does oracle use sql?
How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?
What is the difference between a procedure and a function?
What is count * in sql?
What is oracle sql called?
What is oracle pl sql developer?
What does t sql mean?
How to process query result in pl/sql?
What is vector point function?
What are local and global variables and their differences?
Define commit?
What is application trigger?
what is the difference between union and union all? : Sql dba
explain the difference between bool, tinyint and bit. : Sql dba