how to calcuate the second highest salary of he employee

Answer Posted / hari krishna j

SELECT A.SAL FROM EMP_TAB A
WHERE 1=(SELECT COUNT(*) FROM EMP_TAB B
WHERE B.SAL > A.SAL)

Change value of 1 if
0 - First heighest sal
1 - Second " "
2 - Third heighest sal
.
.
.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is nvarchar in sql?

714


What are the different ways to optimize a sql query?

678


Define commit, rollback and savepoint?

765


Is sql easier than java?

734


What is the difference between database trigger and stored procedure?

739






Is drop table faster than truncate?

740


what is the difference between $message and $$message? : Sql dba

741


What is type and rowtype in pl sql?

741


What action do you have to perform before retrieving data from the next result set of a stored procedure ?

2296


Define tables and fields in a database

833


What is the difference between a primary key and a unique key?

745


What are the different dcl commands in sql?

761


how to rename an existing column in a table? : Sql dba

695


How can the performance of a trigger be improved?

774


What is pl sql architecture?

682