ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Software >> Databases >> SQL PLSQL
 
 


 

 
 Oracle interview questions  Oracle Interview Questions (2040)
 SQL Server interview questions  SQL Server Interview Questions (1080)
 MS Access interview questions  MS Access Interview Questions (25)
 MySQL interview questions  MySQL Interview Questions (194)
 Postgre interview questions  Postgre Interview Questions (6)
 Sybase interview questions  Sybase Interview Questions (22)
 DB Architecture interview questions  DB Architecture Interview Questions (5)
 DB Administration interview questions  DB Administration Interview Questions (213)
 DB Development interview questions  DB Development Interview Questions (53)
 SQL PLSQL interview questions  SQL PLSQL Interview Questions (775)
 Databases AllOther interview questions  Databases AllOther Interview Questions (107)
Question
write a query to find out the no. of employees whose age is 
less than 25 and max of salary for the employees belonging 
to a particular department is less than 20000
 Question Submitted By :: SQL-PLSQL
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
select dept,count(emp),max(sal)
from a
where age < 25
group by dept
having max(sal) < 20000
 
Is This Answer Correct ?    10 Yes 1 No
Khushbu Patel
 
Answer
# 2
Ignore my previous post. it is wrong.

select dept,count(emp),max(sal) from employee where age <25
group by dept having max(sal) <20000
 
Is This Answer Correct ?    1 Yes 0 No
Vikneswaran Thangarasu
 
 
 
Answer
# 3
select dept,count(emp),max(sal) from employee where age <25
and sal <20000 group by dept
 
Is This Answer Correct ?    1 Yes 1 No
Vikneswaran Thangarasu
 
Answer
# 4
select dept,count(emp) from employee where age <25 and max
(sal) <20000 group by dept.
 
Is This Answer Correct ?    3 Yes 4 No
Priya
 
Answer
# 5
There is little mistake in Nitin the MONTHS_BETWEEN
(SYSDATE,hiredate)should be stated like this because if we
place hiredate firt the output comes in Negative, so it
gives all record.

select DEPTno,COUNT(EMPno),max(SAL)
from EMP
where (TO_CHAR(sysdate,'yyyy') - TO_CHAR(HIREDATE,'yyyy'))
< 25
GROUP BY DEPTno
having max(sal) < 20000
 
Is This Answer Correct ?    1 Yes 2 No
Pradeep
 
Answer
# 6
SELECT department_id, COUNT(employee_id), MAX(salary)
FROM employees
WHERE MONTHS_BETWEEN(hire_date, SYSDATE) < 25*12
GROUP BY department_id
HAVING MAX(salary) < 20000;
 
Is This Answer Correct ?    2 Yes 5 No
Nitin Umale
 

 
 
 
Other SQL PLSQL Interview Questions
 
  Question Asked @ Answers
 
Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 all the emp which does not have any dept? Q4 get all the emply detais with the dept details it dept is exit otherwise any emp details? Q5 how to debugg the dynamic sql and packages?   2
In a table only one column how to update rows Microsoft 5
Give an example of Full Outer Join? IBM 1
what is the difference between union and union all Oracle 14
How do you retrieve set of records from database server. {Set max records = 100 & use paging where pager page no or records = 10 & after displaying 100 records again connect to database retrieve next 100 } DELL 2
why we use nocopy? Polaris 2
In a PL/SQL block,which loop type should be used in a performance point of view & Why (as both loops can do the same task) 1) open - Fetch loop 2) for loop JDA 2
What will be the output of this Query? select to_char(trunc(add_months(sysdate-3),mm),mm/dd/yyyy) from dual Cap-Gemini 4
When the mutating error will comes? and how it will be resolved?   2
while loading data into database how can u skip header and footer records in sql*loader oracle 1
What is the difference between the Primary and Foreign key? Cap-Gemini 7
what is purge command explain about oracle performance tuning Accenture 2
 
For more SQL PLSQL Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com