From an Employee table, how will you display the record
which has a maximum salary?

Answer Posted / pradeep

To get nth rank salary or max salary two ways

below 5th

select ct , empno, sal from (SELECT max(rownum) ct , empno,
sal FROM emp group by empno, sal ORDER BY sal desc) where
ct =5;

below 2nd

select * from (
SELECT DEPTNO,ENAME,SAL,COMM,
RANK() OVER ( ORDER BY SAL DESC, COMM) poK from emp)
where pok =2;

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you rank data in sql?

513


what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba

500


What is an oracle stored procedure?

586


What type of database is cloud sql?

572


what are the different index configurations a table can have? : Sql dba

566






Do prepared statements prevent sql injection?

526


What does sql stand for?

540


Does a join table need a primary key?

528


What is time based sql injection?

484


write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba

538


What are the ddl commands?

531


what is the difference between cluster and non cluster index? : Sql dba

548


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1150


List the ways to get the count of records in a table?

503


What are the parameter modes supported by pl/sql?

530