ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Databases  >>  Oracle  >>  Oracle General
 
 


 

 
 Oracle General interview questions  Oracle General Interview Questions
 OCI interview questions  OCI Interview Questions
 Architecture interview questions  Architecture Interview Questions
 Oracle Security interview questions  Oracle Security Interview Questions
 Database Management interview questions  Database Management Interview Questions
 Forms Reports interview questions  Forms Reports Interview Questions
 Oracle AllOther interview questions  Oracle AllOther Interview Questions
Question
how will I find the first 5 highest salaried employees in 
each dept in oracle.
 Question Submitted By :: Gettosrinivas
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 1
SELECT salary FROM employee where rownum < 6 ORDER BY 
salary DESC
group by dept;
 
Is This Answer Correct ?    4 Yes 10 No
Lakshya
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 2
SELECT employee_id, employee_name, salary FROM employees
where rownum < 6 ORDER BY 
salary DESC
group by department_id;
 
Is This Answer Correct ?    2 Yes 8 No
Manoj
 
 
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 3
select sal from (SELECT distinct sal FROM emp order by sal 
desc)
where rownum <6
 
Is This Answer Correct ?    3 Yes 4 No
Uttam
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 4
select a.sal,a.emp_no from employee a
where 5=(select distinct(count(*) from 
employee b where a.sal> b.sal)
 
Is This Answer Correct ?    3 Yes 2 No
Jas
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 5
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 ?    1 Yes 1 No
Manjusure@yahoo.co.in
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 6
select distinct sal from emp a where 5 >(select count
(distinct sal) from emp where sal>a.sal) order by a.sal desc
 
Is This Answer Correct ?    3 Yes 0 No
Praveen Marigaddi.
 
  Re: how will I find the first 5 highest salaried employees in each dept in oracle.
Answer
# 7
Try This,

select empno,deptno,sal,dense_rank from (SELECT empno, 
deptno,sal,
DENSE_RANK() OVER (PARTITION BY
deptno ORDER BY sal DESC NULLS
LAST) DENSE_RANK
FROM emp) tmp
where dense_rank<=5;

Regards,
Murali
 
Is This Answer Correct ?    0 Yes 0 No
Murali Mohan
 

 
 
 
Other Oracle General Interview Questions
 
  Question Asked @ Answers
 
What does a Control file Contain ?  1
What is an Integrity Constrains ?  1
What is Parallel Server ?  1
What is mean by Program Global Area (PGA) ? Bajaj2
Hi All, Recently I attended a interview for a developer position in an educational university. They asked me the a question, I answered somehow but I was not not satisfied myself. Can anybody reply for it? The question is: A business user comes to you directly with an urgent request:: there is a problem with some students not being able to re-enrol. It appears that ?something has gone wrong with the end-dating of some previous courses they had enrolled in, and this is preventing them from completing their on-line re-enrolments?. Fortunately the user has done some analysis on the situation, and has developed some code to change the end dates. They tell you that they have tested this code in the ?dev? environment, and it works fine. They are asking you to please get this implemented in production as soon as possible. What steps would you take in response to their request ? Thanks  1
find out the third highest salary? HCL26
What is Read-Only Transaction ?  1
what is the syntax of UPDATE command?  4
What is RULE-based approach to optimization ?  1
what is analyze command ? what kind of statistics does it generate?  1
Please explain the difference between outer join and inner join? With examples would be appreciable..! IBM2
what is the syntax of update command? Semantic-Space1
What is meant by recursive hints ?  1
Maximum how many triggers can be updated in table ? Accenture4
how to insert data into partitioned table partition done by Range partition  1
What are the type of Synonyms?  1
What are synonyms used for ?  2
What is a View ?  3
What is a Segment ?  1
what are the differen between key flexifild and discriptive fiexifild.  1
 
For more Oracle General Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com