State about GROUP BY Clause

     

  • The GROUP BY clause is used with the SQL SELECT statement.
  •  

    State about Group by clasue flow chart

     

  • Once rows are retrived from the table, It is used to group rows which is having SAME VALUE
  •  

  • Grouping of rows based on the values of specific column or expression
  •  

  • AGGREGATE functions can be used to get summary data for every group
  •  

  • Through the execution of AGGREGATION functions we can eliminate duplicate rows from result set
  •  

  • Through the execution of GROUP BY CLAUSE we can produce SUMMARISED data from DETAILED DATA
  •  

     

     

    Error message will display if either aggregate function or group by clause not exists

     

  • When multiple columns are used, those should be place in reverse order
  •  

  • All columns that are specified in SELECT list must be mentioned in GROUP BY CLAUSE. But columns included in GROUP BY clause need not specify in SELECT LIST
  •  

  • Use IS [NOT] NULL as comparision operator in the WHERE CLAUSE of SELECT statement to avoid NULL values. Otherwise all the columns having NULL values forms as group
  •  

 

 

Columns mentioned in SELECT CLAUSE should have mention in GRUOUP BY clause

 

The column used in GROUP BY CLAUSE only displaying in OUTPUT

 

* should not use in select query