Conditional Aggregates
Learn about conditional aggregates, a way to use aggregate functions based on a given set of conditions.
StartConditional Aggregates
Lesson 1 of 1
- 1Aggregate functions compute a single result from a set of multiple input values. You can think of aggregate data as data collected from multiple rows at a time. In this lesson, we’ll continue l…
- 4Sometimes you want to look at an entire result set, but want to implement conditions on certain aggregates. For instance, maybe you want to identify the total amount of airports as well as the to…
- 5We can do that same thing for other aggregates like SUM(). For instance, if we wanted to sum the total flight distance and compare that to the sum of flight distance from a particular airline (in t…
- 6Oftentimes we’d like to combine aggregates, to create percentages or ratios. In the instance of the last query, we might want to find out the percent of flight distance that is from United by ori…
- 7Modify the previous elevation example to find the percentage of high elevation airports (elevation >= 2000) by state.
- 8Congratulations! You just learned about Conditional Aggregates in SQL. What can we generalize so far? * Conditional Aggregates are aggregate functions the compute a result set based on a give…