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 data manipulation language? : Sql dba
Advantages and disadvantages of stored procedure?
what is a relationship and what are they? : Sql dba
What are different categories of sql commands?
What is the life of an sql statement?
Why plvtab is considered as the easiest way to access the pl/sql table?
What is a field in a database?
how to load data files into tables with 'mysqlimport'? : Sql dba
how to write date and time literals? : Sql dba
Is keyword pl sql?
Difference between truncate, delete and drop commands?
explain about mysql and its features. : Sql dba
Explain the purpose of %type and %rowtype data types?
how would you enter characters as hex numbers? : Sql dba
What is the maximum database size for sql express?