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
What are oracle functions?
What are joins, explain all types of joins?
How to use regular expression in pattern match conditions in oracle?
does the query needs a hint to access a materialized view?
Explain the characteristics of oracle dba?
Please explain joins in oracle?
What is a sub query and what are the different types of subqueries?
What is translate in oracle?
What is not equal to in oracle?
How to use "in" parameter properly?
How to use "while" statements in oracle?
How do we create privileges in oracle?
How to set a transaction to be read only in oracle?
In SAP ECC 6.0 , under DB02 tcode , Tablespace name to be explain stepy step all the col
How to use "startup" command to start default instance?