Write a query to find second highest salary of an employee.
Answer Posted / humayun quaiser
slect max(sal) from emp
where sal not in (select max(sal) from emp);
or
select max(sal) from emp
where sal<(select max(sal) from emp);
or
select distinct sal from emp e
where 1=(select count(distinct sal) from emp
where sal>e.sal);
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the most restrictive isolation level? : Transact sql
What is partition in sql query?
how many values can the set function of mysql take? : Sql dba
how many groups of data types? : Sql dba
What is java sql drivermanager?
What are the types of triggers in sql?
What is the difference among union, minus and intersect?
How many types of privileges are available in sql?
what is dbms? : Sql dba
How many subqueries can be nested in a statement?
What is the importance of sqlcode and sqlerrm?
How exception handling is done in advance pl/sql?
What are the advantages of pl sql?
What is user in sql?
Does google use sql?