how will I find the first 5 highest salaried employees in
each dept in oracle.

Answers were Sorted based on User's Feedback



how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / sunil panghal

select rownum as row_id,salary from (select salary from
employees order by salary) where rownum <6;

Is This Answer Correct ?    1 Yes 2 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / rammohan

select rownum as row_id,sal from (select sal from
emp order by sal desc) where rownum <6;

Is This Answer Correct ?    1 Yes 2 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / uttam

select sal from (SELECT distinct sal FROM emp order by sal
desc)
where rownum <6

Is This Answer Correct ?    13 Yes 15 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / manjusure@yahoo.co.in

select * from emp e where 5> (select count(max(sal)) from emp
where e.deptno=deptno and sal>e.sal group by sal);

Is This Answer Correct ?    4 Yes 6 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / mihir nasikkar

select *
from employee X
where salary in (select top 5 salary
from employee
where dept = X.dept
order by salary desc)
order by dept, salary desc

Is This Answer Correct ?    2 Yes 4 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / mangesh

SELECT * FROM (SELECT * FROM EMP ORDER BY SALARY desc) WHERE ROWNUM < 6;

Is This Answer Correct ?    0 Yes 2 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / md valiyullah

select max(sal)-5 from emp;

Is This Answer Correct ?    2 Yes 6 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / md valiyullah

select max(sal)-5 from emp where dept = 'sale'
union all
select max(sal)-5 from emp where dept = 'purchase'

Is This Answer Correct ?    0 Yes 4 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / dhanalakshmi

select salary
from employee
where rownum<6
group by deptno,salary
order by salary desc

Is This Answer Correct ?    0 Yes 9 No

how will I find the first 5 highest salaried employees in each dept in oracle...

Answer / tytry

ytytry

Is This Answer Correct ?    0 Yes 9 No

Post New Answer

More Oracle General Interview Questions

how to find find & delete duplicate rows from two different tables?

3 Answers   Accenture, TCS,


Explain the use of parfile option in exp command.

0 Answers  


Is there a function to split a string in plsql?

0 Answers  


Can u please explain me the Discussion on Except ,using cast like type cast. Question in the context of difference between two tables

0 Answers   Microsoft,


What is a oracle database?

0 Answers  






How to get a create statement for an existing table?

0 Answers  


16. Display the order number, order line number and the shipping date. If the shipping date is null, display the string <not shipped yet>.

1 Answers   Wipro,


SQL> CREATE TABLE to_table 2 (col1 NUMBER); Table created. SQL> CREATE OR REPLACE TRIGGER statement_trigger 2 AFTER INSERT ON to_table 3 BEGIN 4 DBMS_OUTPUT.PUT_LINE('After Insert Statement Level'); 5 END; 6 / Trigger created. SQL> CREATE OR REPLACE TRIGGER row_trigger 2 AFTER INSERT ON to_table 3 FOR EACH ROW 4 BEGIN 5 DBMS_OUTPUT.PUT_LINE('After Insert Row Level'); 6 END; 7 / Trigger created. SQL> INSERT INTO TO_TABLE VALUES(1); After Insert Row Level After Insert Statement Level 1 row created. SQL> BEGIN 2 INSERT INTO TO_TABLE VALUES(2); 3 INSERT INTO TO_TABLE VALUES(3); 4 INSERT INTO TO_TABLE VALUES(4); 5 INSERT INTO TO_TABLE VALUES(5); 6 INSERT INTO TO_TABLE VALUES(6); 7 INSERT INTO TO_TABLE VALUES(7); 8 INSERT INTO TO_TABLE VALUES(8); 9 INSERT INTO TO_TABLE VALUES(9); 10 INSERT INTO TO_TABLE VALUES(0); 11 END; 12 / WAT LL BE THE O/P??? XPLAIN IT>>>>

1 Answers   Infosys,


How you open and close a cursor variable.Why it is required?

2 Answers  


1.What is inline function in oracle and its purpose? 2.What is the equivalent operator for "different from pattern" in oracle? 3. If you define a variable in oracle, how it will be available? [a. Until database shut down b. Until table deleted c. until session get expired]

2 Answers  


How to export your own schema?

0 Answers  


Briefly explain what is literal? Give an example where it can be used?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)