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 |
Which isolation level provides maximum concurrency?
What is a Resource Control Table(RCT)? Describe its characteristics.
how we will do null data selection in cobol-db2 program
database DSNDB01 means a.db2 catalog b.db2 directory c.BSDS d.active logs answer with reason please
What are the functions of Bind?
What is host variable in db2 cobol?
Explain the function of data manager.
Why do we need reorg in db2?
What's the Maximum Length of SQLCA and what's the content of SQLCABC?
How to get Top 10 Salaries from a Table
1. what if null values retrived from database and no null indicator mentioned in query. What is sql code.
How can you compare table column after update and before update?