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
How do you use join?
What program will open a mdb file?
where are cookies actually stored on the hard disk? : Sql dba
What is a table?
what is log shipping? : Sql dba
What are views in sql?
What is null in pl/sql?
What is the purpose of the primary key?
Can I learn sql in a week?
What is an index? What are the types of indexes? How many clustered indexes can be created on a table?
Is not null in sql?
How can I see all tables in sql?
What is materialized view. What are different methods of refresh?
Explain the working of foreign key?
What is sql character function?