how to find the second highest salary from emp table?
Answer Posted / manikishore
select * from emp e where
2 =(select count(distinct sal) from emp where e.sal<=sal);
//if you want to retrieve 3rd max(sal) then you can use 3 in place of 2,,,like that for so on..
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
explain the delete statements in sql
Explain what is table in a database?
what are the drivers in mysql? : Sql dba
Is a secondary key the same as a foreign key?
Why do we use %rowtype & %type in plsql?
What kind of join is join?
How to process query result in pl/sql?
Why is a primary key important?
What are the ways on commenting in a pl/sql code?
How can I tell if sql is running?
what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba
How we can create a table in pl/sql block. Insert records into it? Is it possible by some procedure or function? Please give example?
How can use stored procedures in sql?
Can we use insert statement in function?
What normalization means?