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

Answer Posted / pawan

Select DISTINCT TOP 5 salary from emp_table1
UNION ALL
Select DISTINCT TOP 5 salary from emp_table2

for more details about UNION and UNION ALL check this: http://www.w3schools.com/sql/sql_union.asp

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a trigger example in oracle?

573


> CREATE OR REPLACE FUNCTION FACTORIAL_1(factstr varchar2 ) 2 RETURN NUMBER AS 3 new_str VARCHAR2(4000) := factstr||'*' ; 4 fact number := 1 ; 5 BEGIN 6 7 WHILE new_str IS NOT NULL 8 LOOP 9 fact := fact * TO_NUMBER(SUBSTR(new_str,1,INSTR(new_str,'*')-1)); 10 new_str := substr( new_str,INSTR(new_str,'*')+1); 11 END LOOP; 12 13 RETURN fact; 14 15 END; explanation Above program?

1569


How do I limit the number of rows returned by an oracle query after ordering?

629


How to do paging with oracle?

573


How do I reset a sequence in oracle?

593






How we can able to import our own template (users designed MS-Word templates) which has many tabular columns; need to pass some values generate by Oracle-reports9i? Actually need to import more than 400 MS-Word templates into Oracle Reports-9i to minimize layout design in Reports.

1610


How can I get column names from a table in oracle?

534


Explain the use of owner option in exp command.

569


Can we connect to ORACLE db using Windows Authentication?

722


List the parts of a database trigger.

579


What is a cognitive schema?

526


Why do I get java.lang.abstractmethoderror when trying to load a blob in the db?

553


What is data file?

617


How to select all columns of all rows from a table in oracle?

588


What are the differences between date and timestamp in oracle?

551