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 copy book?

1 Answers   Thomson Reuters,


What does a deadlock mean in DB2?

0 Answers  


What is the maximum length of a column name in DB2? 18 or 30 or anything other than these?

4 Answers  


where can we use index and subscript ? with example ?

3 Answers   CTS,


What are the different methods of accessing db2 from tso? How is the connection established between TSO & DB2?

3 Answers   Tech Mahindra,


What is node in db2?

0 Answers  


Describe what a storage group(STOGROUP) is?

2 Answers  


DB2 is a A) data base/data communication system B) data base C) RDBMS D) Programming language

4 Answers   Accenture,


Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?

0 Answers  


Hi Team, Please tell me, If i don't declare the cursor in the program and i have given open and fetch and close, then what error will get.

6 Answers   IBM,


How is a typical DB2 batch program executed ?

1 Answers  


Give the COBOL definition of a VARCHAR field.

2 Answers  


Categories