What is the difference between a HAVING CLAUSE and a WHERE
CLAUSE?

Answers were Sorted based on User's Feedback



What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / guest

Having Clause is basically used only with the GROUP BY
function in a query. WHERE Clause is applied to each row
before they are part of the GROUP BY function in a query.

Is This Answer Correct ?    68 Yes 4 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / srinivas

HAVING CLAUSE is used for evaluating a condition with an
aggregate function, i.e., GROUP BY whereas WHERE CLAUSE is
used for general conditions.

Is This Answer Correct ?    35 Yes 4 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / manisha

Having clause is used to filter group while WHERE CLAUSE
is used to filter rows.
Having clause can have aggregate function but WHERE CLAUSE
cannot have aggregate function.

Is This Answer Correct ?    22 Yes 9 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / menagadev

The HAVING clause sets conditions on the GROUP BY clause
similar to the way WHERE interacts with SELECT. The WHERE
search condition is applied before the grouping operation
occurs; the HAVING search condition is applied after the
grouping operation occurs. The HAVING syntax is exactly
like the WHERE syntax, except HAVING can contain aggregate
functions.

Is This Answer Correct ?    3 Yes 0 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / swati mandve

where clause is executed (for each row) first and
written before the group by statement..
having clause is strictly folllowed by groupby clause.to
filter the group.

Is This Answer Correct ?    3 Yes 0 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / sararh

where clause uesd for the fiend out particulater records and
where clause u write after select statement.

Having clause used for combination of group by functions
with out group by function u can nit write the having caluse.

Is This Answer Correct ?    1 Yes 0 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / ravindran

1.WHERE clause can be used with SELECT,INSERT and UPADATE statements,where as HAVING clause can only be used with the SELECT statements.

2.WHERE filter after rows before aggregation(GROUPING),
where as,HAVING filters groups,after the aggregations are performed.

3.Aggregate functions cannot be used in the WHERE clause,unless it is in a sub query containing in a HAVING clause,where as,aggregate functions can be used in having clause.

Is This Answer Correct ?    1 Yes 0 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / santosh pashupatimath

Having clause is used before aggregation and where clause is
used before aggregation

Is This Answer Correct ?    1 Yes 1 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / saisri

Where clause is used prior the grouping of data,
where as Having is used after grouping the result of the
data.

Is This Answer Correct ?    1 Yes 5 No

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..

Answer / sudheer gowlikar

Having clause Specifies a search condition for a group or
an aggregate. HAVING can be used only with the SELECT
statement. HAVING is typically used in a GROUP BY clause.
When GROUP BY is not used, HAVING behaves like a WHERE
clause.

Is This Answer Correct ?    2 Yes 9 No

Post New Answer

More SQL Server Interview Questions

What protocol does sql server use?

0 Answers  


You have a table ‘test’ which is a copy of northwind employee table you have written a trigger to update the field ‘hiredate’ with the current date

0 Answers  


Describe in brief databases and sql server databases architecture.

0 Answers  


How to loop through result set objects using mssql_fetch_array()?

0 Answers  


How to join two tables in a single query in ms sql server?

0 Answers  






Wht is the difference between stored procedure and trigger

6 Answers   HCL, TCS,


Data is not being delivered to subscribers, what can be the possible reasons? : sql server replication

0 Answers  


How to Generate a Series of Random Integers With T-SQL?

1 Answers  


How do you find the error, how can you know the number of rows effected by last SQL statement?

1 Answers  


Why we are using the sql language?. What is the purpose of using this?

2 Answers  


What is the user of Primary key?

0 Answers  


What is the difference between varchar and nvarchar?

0 Answers  


Categories