On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Eliminating duplicate results
15. Find the sum
HAVING: filtering and ordering groups
Let's practice


That's right. The last function that we'll discuss is SUM().

Examine the example:

SELECT SUM(total_sum)
FROM orders
WHERE customer_id = 100;

The above instruction will find the total sum of all orders placed by the customer with id 100.


Find the sum of all salaries in the Marketing department in 2014. Remember to put the department name in inverted commas!

Stuck? Here's a hint!


SELECT SUM(salary)
FROM employees
WHERE year = 2014
  AND department = 'Marketing';