Database - Introduction to SQL - Discussion

Discussion :: Introduction to SQL - General Questions (Q.No.17)


The HAVING clause does which of the following?

[A]. Acts like a WHERE clause but is used for groups rather than rows.
[B]. Acts like a WHERE clause but is used for rows rather than columns.
[C]. Acts like a WHERE clause but is used for columns rather than groups.
[D]. Acts EXACTLY like a WHERE clause.

Answer: Option A


No answer description available for this question.

Kiran said: (Aug 28, 2011)  
You cannot use an aggregation function to limit rows in WHERE clause. Use HAVING clause to limit the groups returned by GROUP BY clause.

Dishant said: (Nov 11, 2011)  
Please tell me that or give example of this HAVING query.

Pooja said: (Mar 4, 2012)  
"Where" is a kind of restiriction statement. You use where clause to
restrict all the data from DB.Where clause is using before result
retrieving. But Having clause is using after retrieving the data.
Having clause is a kind of filtering command.

Ragunandhan said: (Jul 5, 2012)  
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.

Ashish said: (Jul 28, 2012)  
"having " clause is act as an constraint/condition whenever we use group by clause.

Chandra said: (Aug 27, 2013)  
In the group By class only we can use Having because in that we are checking more records. In Where we can't check group it is only applicable for only one condition.

Kanimozhi said: (Dec 26, 2016)  
WHERE clause is used for filtering rows, while HAVING clause is used for filtering groups.

Deepamarisamy said: (Feb 2, 2018)  
Please explain HAVING and WHERE clause?

Vandna said: (Oct 20, 2018)  
Can anyone give a short example for HAVING please?

Manjula P said: (Nov 5, 2018)  
Example for having clause.

SELECT COUNT(CustomerID), Country.
FROM Customers.
GROUP BY Country.
HAVING COUNT(CustomerID) > 5;.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.