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 I order by ascending in sql?
How many joins in sql?
what is acid property in database? : Sql dba
What is int identity in sql?
How do you concatenate in sql?
Does a primary key have to be a number?
How do I run a pl sql procedure in sql developer?
What is the difference between numeric and autonumber?
What is the difference among union, minus and intersect?
Define overloaded procedure?
What is $$ in sql?
What is sqlite used for?
What is percent sign in sql?
Explain the components of sql?
What is sql exception?