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
Define implicit and explicit cursors.
what happens if null values are involved in expressions? : Sql dba
Enlist the characteristics of pl/sql?
What is the difference between row level and statement level trigger?
How do you declare a constant?
What is oracle sql developer?
How do you update f as m and m as f from the below table testtable?
How do I delete a trigger?
How do I edit a stored procedure?
Is pl sql still used?
what are set operators in sql? : Sql dba
how to show all tables with 'mysql'? : Sql dba
What are all the different normalization?
What is sql and how does it work?
What is cursor in pl sql?