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

Answer Posted / gvmahesh

I write the query for this question using OLAP functions.

select e1.* from (select ename,sal,rank()
over(order by sal desc) rank from emp) e1
where e1.rank=2;

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is sql*loader direct path so fast?

803


What are tables and fields?

764


What if we write return in procedure?

978


What is posting?

781


Is it important to partition hard disk?

750


how tsql statements can be written and submitted to the database engine? : Transact sql

717


Why is a primary key important?

738


Does asenumerable execute the query?

776


How to pronounce postgresql?

772


How many developers work on postgresql?

736


What are the advantages of pl sql?

835


What is an alias command?

766


Is it possible to read/write files to-and-from PL/SQL?

847


How to avoid duplicate records in a query?

749


Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.

766