Write a query to find second highest salary of an employee.

Answer Posted / rajasekhar.v

For selecting Nth highest salary...

SQL> select rownum rank,ename,sal from
(select ename,sal from emp order by sal desc)
group by rownum,ename,sal
having rownum = &n;
'n' may be any valid number required..

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is $$ in sql?

555


Is sql procedural language?

554


What is an inner join sql?

549


what is 'trigger' in sql? : Sql dba

559


Is full outer join same as cross join?

505






What is difference between joins and union?

535


Can we use views in stored procedure?

515


What is the use of partition by in sql?

517


What is right join in sql?

555


what is meant by urlencode and urldocode? : Sql dba

603


Does user triggers have entry for trigger with compilation errors?

600


what is the command line end user interface - mysql? : Sql dba

505


What are the benefits of pl sql?

530


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

621


Why we use triggers in mysql?

560