Grouping the similar data is called ‘Group By’.
The SQL GROUP BY clause is used in collaboration with the SELECT
statement to arrange identical data into groups. This GROUP BY clause follows
the WHERE clause in a SELECT statement and precedes the ORDER BY clause.
The GROUP BY
statement is often used with aggregate
functions (COUNT()
, MAX()
, MIN()
, SUM()
, AVG()
) to group the result-set by one or more columns.
Display
the count of each and every country.
Syntax:
Having Clause along with
Group By
- The SELECT statement is used with the GROUP BY clause in the SQL query.
- WHERE clause is placed before the GROUP BY clause in SQL.
- ORDER BY clause is placed after the GROUP BY clause in SQL.
No comments:
Post a Comment