We use the SUM () function to determine the total value of all the rows in a column. This example uses MonthsWithOwner.

Select SUM (MonthsWithOwner) AS 'Total Months of Cat Ownership'

FROM Cat;
OUTPUT

MonthsWithOwner
——————

10055

(1 row(s) affected)

Select SUM (MonthsWithOwner) AS 'Total Months of Cat Ownership for Black Cats'

FROM Cat

WHERE ColorOfCat = 'Black';
OUTPUT

MonthsWithOwner
——————

1591

(1 row(s) affected)