what is the difference between where clause and having clause
Answers were Sorted based on User's Feedback
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 |
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 |
What is iseries database?
What language is db2 written in?
What is the difference between bind and rebind in db2?
How many Buffer pools are there in DB2 and what are they?
What is the default page size of buffer pools?
What is an asychronous write?
how can u retrieve the data from null values using applicaion program.
how many bytes timestamp token occupies?
6 Answers Boss Global, Cap Gemini, TCS,
What is the purpose of using commit?
What is the syntax for seeing the columns and data types of a table in the db2 database?
What is plan in cobol db2?
Normalization in DB2 – first normal form, second normal form