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 (2035)
 SQL Server interview questions  SQL Server Interview Questions (1075)
 MS Access interview questions  MS Access Interview Questions (24)
 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 (768)
 Databases AllOther interview questions  Databases AllOther Interview Questions (106)
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 :: Praveen
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
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
 
  Re: 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
Answer
# 2
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
 
 
 
  Re: 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
Answer
# 3
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
 
  Re: 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
Answer
# 4
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
 
  Re: 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
Answer
# 5
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
 
  Re: 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
Answer
# 6
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
 

 
 
 
Other SQL PLSQL Interview Questions
 
  Question Asked @ Answers
 
How to convert ms-excel file to oracle table?   2
What is difference between triggers and stored procedures. And advantages of SP over triggers ? TCS 4
I want to display the employees who have joined in last two months. (It should be executed randomly means If I execute the query in March it should display Jan and Feb joined employees. Same query if i execute in Feb, 2007 it should display dec, 2006 and jan 2007 joined employees. Wipro 12
how u can find the n row from a table? Tech-Mahindra 17
SELECT flavor, SUM (ice_cream_sales) FROM sales_detail GROUP BY flavor ORDER BY 2 DESC If the "sales_detail" table contains ten records with different values in the flavor column (two "vanilla," three "chocolate," four "strawberry," and one NULL), how many rows are returned by the sample code above? 1. 0 rows 2. 1 row 3. 3 rows 4. 4 rows 5. 10 rows Sonata 8
what is meant by DML? HCL 5
How to fetch the rows by dynamicaly passing table name through cursor?   3
how do u call in & out parameters for stored procedures? A1-Technology 10
select 1,col1,col2 from table1. output? Ramco 5
When would you denormalize? Microsoft 8
what are the differences among these table level lock modes - IN SHARE MODE, IN SHARE UPDATE MODE, IN EXCLUSIVE MODE ? HCL 2
How to call the function and Procedure in trigger? IBM 3
 
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