Query to get max and second max in oracle in one query ?
Answer Posted / rohit
The below query will provide the max and second max in
oracle in one query
select * from emp e
where 0 = (select count(sal) from emp
where e.sal < sal)
or 1 = (select count(sal) from emp
where e.sal < sal);
| Is This Answer Correct ? | 17 Yes | 8 No |
Post New Answer View All Answers
How to concatenate two text values in oracle?
What is an oracle table?
What is oracle datasource?
Is oracle an operator?
How many types of table in Oracle?
How to use existing values in update statements using oracle?
What view(s) do you use to associate a users SQLPLUS session with his o/s process?
What is object data modeling?
Why we use bulk collect in oracle?
What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?
What is oracle rownum?
What is parameterized cursor in oracle?
You have found corruption in a tablespace that contains static tables that are part of a database that is in NOARCHIVE log mode. How would you restore the tablespace without losing new data in the other tablespaces?
What do you understand by database schema and what does it hold?
What is the maximum number of triggers that can be applied to a single table?