adspace


Write a query to find five highest salaries from EMP table.
(there is a column SALARY)

Answer Posted / sreenivasreddy

SELECT ROWNUM, E1.*
FROM (SELECT EName, Deptno, Sal,
DENSE_RANK()
OVER(ORDER BY Sal DESC) EmpRank
FROM Emp
GROUP BY Deptno, EName, Sal
ORDER BY EmpRank) E1
WHERE E1.EmpRank <= 5
ORDER BY ROWNUM

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is dbms? : Sql dba

1072


Is primary key clustered index?

1028


what is collation? : Sql dba

1242


how many tables will create when we create table, what are they? : Sql dba

1157


If a cursor is open, how can we find in a pl/sql block?

1252


What is the current version of sql?

1106


Is inner join faster than left join?

1289


what are aggregate and scalar functions? : Sql dba

1142


Can we rollback truncate?

1086


define sql insert statement ? : Sql dba

1110


Does group by remove duplicates?

1122


Do we need to rebuild index after truncate?

1156


What is your daily office routine?

2353


What is the best sql course?

1064


What is the current version of postgresql?

1188