product_id
and quantity
columns from the Sales
table.product_id
to prepare for aggregation.SUM()
function to calculate the total quantity sold for each product_id
.total_quantity
using the AS
keyword.product_id
and total_quantity
.erDiagram Sales { int sale_id int product_id int year int quantity int price } Product { int product_id varchar product_name } Sales }|--|| Product : has