Write a query to find five highest salaries from EMP table.
(there is a column SALARY)
Answer Posted / vivek dubey
this Query is wrong : " SELECT ENAME,SALARY FROM (SELECT ENAME,SAL FROM EMP ORDER BY SALARY DESC ) WHERE ROWNUM<6; " because We can not use Order by clause in SubQuery.
This Answer gives you the right data :
"
SELECT TOP 5
empsal.ENAME,
empsal.SAL
FROM
(
SELECT ENAME,SAL
FROM EMP
) AS empsal
ORDER BY empsal.SAL DESC
"
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?
Can we use ddl commands in pl sql?
What is pl sql package?
Can we group by two columns in sql?
What is a stored procedure in sql with example?
what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba
How long will it take to learn pl sql?
What is trigger in pl sql with examples?
What is oracle and pl sql?
How are functions and procedures called in PL/SQL?
Is primary key an index?
How can we optimize a sql query?
What is the maximum rows in csv?
what is a record in a database ? : Sql dba
Why do we use %rowtype & %type in plsql?