SQL Aggregates
Prework for SQL Aggregates
In your notebook, define the following terms:
- Minimum
- Maximum
- Sum
- Average
If you are unsure of what these terms refer to, check out the guide below, then redefine them in your own words.
Some Math Terms
- Min: The first item in an ordered list. EX: the smallest of a set of numbers.
- Max: The last item in an ordered list. EX: the largest of a set of numbers.
- Sum: The total of a collection of numbers. EX: the sum of {1, 3, 5, 4, 2} is 15.
1 + 3 + 5 + 4 + 2 = 1
- Average: A single number that represents the commonality of a set of numbers. Add up a series of numbers and divide the sum by the total number of values to find the average. EX: the average of {1, 3, 5, 4, 2} is 3.
(1 + 3 + 5 + 4 + 2) / 5 = 3
Watch This Video That introduces Aggregate Functions. After watching the video, reflect on the questions below in your notebook:
- Create a definition for the word ‘aggregate’.
- Do you think we could find the ‘MIN’ value of a text field? Why, or why not?
- What do you think ‘NULL’ represents in SQL?
Watch This Video which introduces GROUP BY. After watching the video, reflect on the questions below in your notebook:
- In your own words, how does ‘GROUP BY’ change the behavior of aggregate functions?
- Copy the text that is shown in the video at 3:53. Do your best to unpack the statement - what does it mean?