Anybody can tell me, how do we find second largest emp
salary from emp table.. Thanks in advance ...

Answer Posted / selvaraj anna university coe

Oracle 10g Using : Find 2nd Highest Salary?

SELECT * FROM emp e WHERE 2=(SELECT COUNT(DISTINCT salary)
FROM emp x
WHERE x.salary >= e.salary);

Answer :

EMP_NO EMP_NAME SALARY
--------- ------------------------- ---------
107 SARABOOT 550000

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to increment dates by 1 in oracle?

562


What happens if variable names collide with table/column names?

584


How to work with data objects interactively?

555


Why does Oracle not permit the use of PCTUSED with indexes?

1953


What is a subquery in oracle?

578






How we can able to import our own template (users designed MS-Word templates) which has many tabular columns; need to pass some values generate by Oracle-reports9i? Actually need to import more than 400 MS-Word templates into Oracle Reports-9i to minimize layout design in Reports.

1612


What is the difference between substr & instr functions?

597


15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.

1701


How remove data files before opening a database?

564


Explain the use of grant option in imp command.

578


Can you assign multiple query result rows to a variable?

548


What are the numeric comparison operations?

631


How to loop through a cursor variable?

569


How to add a new column to an existing table in oracle?

588


What is the difference between postgresql and oracle?

505