Group By SQL Tutorial

Group By Syntax:

SELECT column_name1, aggregate_function(column_name2) FROM table GROUP BY column_name1

Store table:

OBJECT_IDPRICETYPE
1200LOW
2500MEDIUM
3900HIGH
4500MEDIUM

Example:

SELECT type, SUM(price) FROM store GROUP BY type;

TYPEPRICE
LOW200
MEDIUM1000
HIGH900