Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is the difference between where clause and having clause

Answers were Sorted based on User's Feedback



what is the difference between where clause and having clause..

Answer / sriram

WHERE clause is used to impose condition on SELECT
statement as well as single row function and is used before
GROUP BY clause where as HAVING clause is used to impose
condition on GROUP Function and is used after GROUP BY
clause in the query

WHERE applies to rows HAVING applies to summarized rows
(summarized with GROUP BY) if you wanted to find the
average salary in each department GREATER than 333 you
would code:

SELECT DEPARTMENT AVG(SALARY)

FROM EMP

WHERE DEPARTMENT > 333

GROUP BY DEPARTMENT

IF you then wanted to filter the intermediate result to
contain departments where the average salary was greater
that 50 000 you would code:

SELECT DEPARTMENT AVG(SALARY)

FROM EMP

WHERE DEPARTMENT > 333

GROUP BY DEPARTMENT

HAVING AVG(SALARY) > 50000.

Where executes first

GROUP BY next

and finally HAVING


Is This Answer Correct ?    9 Yes 0 No

what is the difference between where clause and having clause..

Answer / selvam a

HAVING clause can only compare a built in function but WHERE
clause can compare column name.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

What is database alias db2?

0 Answers  


In cursor program-1 can we create another cursor program-2 inside the cursor program-1.If yes how/no why ?

2 Answers   Wipro,


what is REORG? what is the use?

4 Answers  


How does coalesce work?

0 Answers  


What is role in db2?

0 Answers  


what is the difference between where clause and having clause

2 Answers   IBM,


What are the various locks available?

5 Answers   CTS,


what is the difference between declaring the cursor in WS section and Procedure division?

1 Answers   HCL,


What is the difference between IN subselects and EXISTS subselect?

1 Answers   HCL, PreVator, TCS,


Describe what a storage group(STOGROUP) is?

2 Answers  


What is cloudant database?

0 Answers  


How can we read records for specific member in CL? AND rpg?

0 Answers  


Categories