What is the difference between HAVING clause and the WHERE
clause?
Answers were Sorted based on User's Feedback
Answer / srinivas
As per my knowledge WHERE is for conditional retrieving but
we cann't use Average Functions in WHERE clause.
HAVING clause can include AVG Functions.
| Is This Answer Correct ? | 20 Yes | 5 No |
Answer / ishika
Having clause works on recordset while Where works on
individual record
| Is This Answer Correct ? | 15 Yes | 4 No |
Answer / chandra kanth
WHERE is for conditional retrieving and having is using
group of records
| Is This Answer Correct ? | 13 Yes | 4 No |
Answer / senthil kumar t
Where clause is used for conditional retreiving from the
table and also aggregate functions can be used in where
clause. Having clause will be used for the recordset this
also supports the aggregate functions
| Is This Answer Correct ? | 10 Yes | 4 No |
Answer / pallavi tiwari
in where clause the data that fetched in memory is according
to condition but in having the completed data firstly
fetched in memory and then seperated according to condition.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / vivek kumar
where clause is used for conditional retriving but having
clause is used to test some condition on the group with the
help of aggregate function.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / mayursinh zala
'Where' clause applies to the individual rows whereas 'Having' clause is used to test some condition on the group(usually aggregate methods) rather than on individual rows.
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.
So you can use having WITHOUT group by clause. This is a sample, although it might make no sense of business value:
select max(state) from States having count(State) > 60
| Is This Answer Correct ? | 0 Yes | 0 No |
How many .ndf files can we create in Sql server 2005?
Explain how dts is used to extract, transform and consolidate data?
Tell me what is the significance of null value and why should we avoid permitting null values?
Is the primary key column of a table an index in ms sql server?
If we shrink the Databse and Files, how much size is decreased?
Do you know the capabilities of cursors?
What are the steps you will take, if you are tasked with securing an SQL Server?
What are the advantages of using views. Why do we need views when we have SPs?
How many columns can we include on clustered index ?
How to Insert multiple rows with a single insert statement?
what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
How many types of indexes are there in SQL Server?
6 Answers CarrizalSoft Technologies, United Healthcare,
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)