77
Grouping and Aggregation
Usually, we want aggregations on certain parts of the relation.
Purchase(product, date, price, quantity)
Example 2:
find total sales after 10/1 per product.
SELECT
product, Sum(price*quantity) AS TotalSales
FROM
Purchase
WHERE
date > “10/1”
GROUPBY
product
Let’s see what this means…