SQL GROUP BY
GROUP BY statement is used in conjunction with the aggregate clauses to group the result-set by one or more columns.It will make groups of same values.SYNTAX :
SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP BY column_name ;
id | name | age | city | bill |
1 | Tom | 34 | Paris | 5300 |
2 | Jhony | 51 | London | 400 |
3 | Ram | 64 | Delhi | 20000.7 |
4 | Simon | 23 | Portland | 32.65 |
EXAMPLE:
select name customers group by name;This would produce following result:
NAME Jhony Ram Simon Tom