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 |
pls explain the precompilation process of cobol-db2 pgm
How do you eliminate duplicate values in db2?
What is syscat in db2?
How does DB2 determine what lock-size to use?
Q1. How will you use two different DB2 qualifiers in a single COBOL program? Suppose we have 2 tables EMP1 and EMP2 with same structure defined in two different DB2 qualifiers QUAL1.EMP1 and QUAL2.EMP2 now during first 15 days we want to use QUAL1.EMP1 and rest of the days QUAL2.EMP2 how will we do this. We can create a single program and a single load for this program.
What is isolation level?
How to find the number of rows in db2 tables?
Can i insert bulk records into a db2 table using qmf of spufi only............!!!
What type of database is db2?
What is an alias?
What is a db2 tablespace?
wht is d/f between union and joins ?