The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.
SELECT column_name, aggregate_function(column_name) FROM table_name
WHERE column_name operator value GROUP BY column_name
Id Name Mark
1 Anu 71
2 Athira 60
3 Faizal 67
4 Anu 69
5 Faizal 49
select Name,sum(Mark) from Student Group By Name
Anu 140
Athira 60
Faizal 116
If you omit Group By then
select Name,sum(Mark) from Student Group By Name ----> will result
Anu 316
Athira 316
Faizal 316
Anu 316
Faizal 316
No comments:
Post a Comment