Professional Documents
Culture Documents
Group By Clause:
Sometimes, rather than retrieving individual records, you want
to know something about a group of records,
The GROUP BY clause is used in a SELECT statement to
collect data across multiple records and group the results by
one or more columns.
The GROUP BY clause returns one row for each group. In
other words, it reduces the number of rows in the result set.
Having Clause
The having clause, is just like the where clause, that filters
the results in aggregated data.
The Where clause cannot be used in the aggregated data,
so SQL having clause is introduced to filter the results.
The having SQL clause is used with the Group by clause.
You can only use those column names in the having
clause that are appeared in the Group by clause.
SQL HAVING Clause