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
How can we optimize a sql query?
Explain the the delete statements in sql?
What is the difference between alter trigger and drop trigger statements?
Which version of sql do I have?
Mention what does the hierarchical profiler does?
what are the differences between char and nchar? : Sql dba
How many types of normalization are there?
What are the types of views in sql?
How do I pipe the output of one isql to another?
How do I run a pl sql procedure in sql developer?
what is a control file ? : Sql dba
Can instead of triggers be used to fire once for each statement on a view?
how many sql dml commands are supported by 'mysql'? : Sql dba
What does <> sql mean?
Hi how to import oracle sequence in Informatica? Please write stored procedure code that will import oracle sequence in Informatica SP transformation as per below scenario Oracle table product list Pro_id, pro_name 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights Now a new flat file with new product list needs to be added to oracle table product list with oracle sequence. flat file product Prono,pro_name, 1, 20 watt tube light 2, 30 watt tube light & target should be like 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights. 104, 20 watt tube light 105, 30 watt tube light thks reg suvarna joshi suvarnaatsuvarna@rediffmail.com