From the course: SQL Essential Training

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Aggregate functions

Aggregate functions - SQL Tutorial

From the course: SQL Essential Training

Aggregate functions

- [Instructor] Let's take a look at another type of function called aggregate functions. Aggregate functions turn a range of numbers into a single point of data based on a variety of mathematical operations. Now let's take a look at an example where we would use our invoice table to calculate the grand total. In other words, let's say we were tasked by WSDA Music Management to get our total global sales of all time. How would we go about constructing a SQL statement to do this? Well, let's first start with our usual from clause, and because we're interested in the total sales, this information is held inside of our invoice table. So let's specify the invoice table after our from, then let's go above our from and specify the select. Now we can introduce our sum aggregate function to calculate the grand total for us. So let's specify sum, and then within parentheses, we want to specify the actual column or field we…

Contents