Query to get max and second max in oracle in one query ?
Answer Posted / sunil
select sal from (select dense_rank() over(order by sal) rank
from emp) where rank in(1,2);
In above query you will get both highest and second highest
salary details even there are more people who are getting
highest and second highest salary.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to display employee records who gets more salary than the average salary in the department?
Can you drop an index associated with a unique or primary key constraint?
Please explain me all types of Data models. Also give me the details if each model can have other name.for example:schematic data model is also known as conceptual data model and entity relation data model.
Is it possible to center an object horizontally in a repeating frame that has a variable horizontal size ?
What are the attributes of cursor?
What is the difference between Delete, Truncate and Drop in Oracle?
Explain index?
What is a relational database management system?
Iam learning oracle developer 2000.. can anyone give me then tutorials sites or PDF related to developer 2000 please send me the details @ mak2786@gmail.com thanks Arun
How does Oracle guarantee data integrity of data changes?
Explain the use of Merge statement in oracle 11g
Does oracle partitioning improve performance?
Point the difference between translate and replace?
How to write a query with a left outer join in oracle?
What is a trigger and what are its types in oracle?