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 is a relational database management system?
What is the difference between post-database commit and post-form commit?
What happens to indexes if you drop a table?
Whats the benefit of dbms_stats over analyze?
In SAP ECC 6.0 , under DB02 tcode , Tablespace name to be explain stepy step all the col
How do you increase the OS limitation for open files (LINUX and/or Solaris)?
What operating systems are supported by oracle database 10g xe?
what is normalisation?what are its uses?
What is recycle bin in Oracle?
what is meant by magic query
What is connection pooling in oracle?
Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given procedure owned by SCOTT to start Wednesday at 9AM and to run subsequently every other day at 2AM.
Explain how are indexes update?
How do I limit the number of oracle database connections generated by weblogic server?
Explain the use of record length option in exp command.