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 copy book?
What does a deadlock mean in DB2?
What is the maximum length of a column name in DB2? 18 or 30 or anything other than these?
where can we use index and subscript ? with example ?
What are the different methods of accessing db2 from tso? How is the connection established between TSO & DB2?
What is node in db2?
Describe what a storage group(STOGROUP) is?
DB2 is a A) data base/data communication system B) data base C) RDBMS D) Programming language
Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?
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.
How is a typical DB2 batch program executed ?
Give the COBOL definition of a VARCHAR field.