find out the second highest salary?
Answer Posted / priyankur
@peter: your query is pretty cool but it wont work when
there are multiple salaries with same amount. I mean three
persons have same salary 24000, which is MAX sal in salary
table. In that case, below query will work.
select a.salary from employees a where 1 = (select count
(distinct b.salary) from employees b where
a.salary<b.salary)
Digit 1 is (n-1) where n is nth value. Here n is 2(Second
highest salary).
I would appreciate if anybody tried to break my above query
and explain how does this work.
Is This Answer Correct ? | 7 Yes | 8 No |
Post New Answer View All Answers
How to enter a new row into a table interactively?
How can I combine multiple rows into a comma-delimited list in oracle?
How to start a specific oracle instance?
How to export several tables together?
ABOUT IDENTITY?
Explain the use of grant option in exp command.
How to speed up webrick?
How to drop an existing table in oracle?
What is a cursor variable?
What is an oracle user account?
What is a cursor in oracle?
Can we convert a date to char in oracle and if so, what would be the syntax?
For a field in a repeating frame, can the source come from the column which does not exist in the data group which forms the base for the frame ?
How to connect to a remote server?
How to use subqueries in the from clause in oracle?