top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the types of SQL GROUP BY Clause?

0 votes
373 views
What are the types of SQL GROUP BY Clause?
posted Sep 14, 2014 by Nimish

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The usage of SQL GROUP BY clause is, to divide the rows in a table into smaller groups.
The GROUP BY clause is used with the SQL SELECT statement.
The grouping can happen after retrieves the rows from a table.When some rows are retrieved from a grouped result against some condition, that is possible with HAVING clause.

The GROUP BY clause is used with the SELECT statement to make a group of rows based on the values of a specific column or expression. The SQL AGGREGATE function can be used to get summary information for every group and these are applied to individual group.
The WHERE clause is used to retrieve rows based on a certain condition, but it can not be applied to grouped result.

In an SQL statement, suppose you are using GROUP BY, if required you can use HAVING instead of WHERE, after GROUP BY.

 SELECT <column_list> 
    FROM < table name > 
    WHERE <condition> GROUP BY <columns> 
    [HAVING] <condition>; 
answer Sep 14, 2014 by Amit Kumar Pandey
...