how to calcuate the second highest salary of he employee

Answer Posted / ramya p

SELECT DISTINCT (sal),deptno FROM emp a
WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM emp b
WHERE a.sal<=b.sal)

N is the Nth highest salary you want to print. In this case
N=2

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The select into statement is most often used to create backup copies of tables or for archiving records?

769


What is error ora-01000: maximum open cursors exceeded

783


What is sql architecture?

745


What are the different schemas objects that can be created using pl/sql?

726


How does a covering index work?

693






how to get help information from the server? : Sql dba

677


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

850


How many unique keys can a table have?

738


what is uncommittable transactions? : Transact sql

752


What is structural independence and why is it important?

756


What is the sql*loader? : aql loader

778


What is sql server and ase?

711


What is coalesce in sql?

732


What does inner join mean?

757


What are the different types of sql commands?

783