What is the difference between a HAVING CLAUSE and a WHERE
CLAUSE?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Answer / santosh pashupatimath
Having clause is used before aggregation and where clause is
used before aggregation
| Is This Answer Correct ? | 1 Yes | 1 No |
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 |
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 |
Tell me what is the significance of null value and why should we avoid permitting null values?
How is foreign key related to primary key?
What are the different types of backups avaialabe in sql server 2005?
my name is sejal I have cleared the sbi clerk exam. I am BCA graduate My favorite subject RDBMS Relational database management system. so please send me rRDBMS related interview questions
Define indexes?
What is bcnf normalization form?
1)what is the difference between Reinitializing a Subscription and synchronization the subscription? 2)when to use reinitializing ? 3)when to use synchronization? 4)when adding table or deleting a table what to do?(reinz.. or syn) 5)when adding a column what to do?
What is sql language?
what are constraints? : Sql server database administration
Can a table have 2 foreign keys?
What is the maximum row of a size?
How to run queries with sql server management studio express?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)