how to find the second highest salary from emp table?
Answer Posted / kishan singh chilwal
SELECT MAX(sal)
FROM emp
WHERE sal <> (SELECT MAX(sal) FROM emp);
<> = not equal to
the SELECT statement in the WHERE clause will find the 1st max sal in the table
the 1st SELECT statement will find max sal in the table after excluding the first max sal
(ALTERNATE WAY)
SELECT MAX(sal)
FROM emp
WHERE sal not in (select max(sal) from emp );
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what is a database lock ? : Sql dba
What is meant by user defined function?
how to get help information from the server? : Sql dba
What is the execution plan in sql?
Can pl sql procedure have a return statement?
Can we create foreign key without primary key?
What is meant by truncate in sql?
Is full outer join same as cross join?
what is sql? : Sql dba
Is oracel sql developer written in java?
What are the built in functions of sql?
what tools available for managing mysql server? : Sql dba
what is the stuff function and how does it differ from the replace function? : Sql dba
Is crud a cuss word?
What is record in pl sql?