From the course: Quick Start Guide to SQL

Unlock the full course today

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

Types of group functions

Types of group functions

- Let's learn about the group functions and the types of group functions that we can use. First of all, what is a group function? A group function works with a group of rows from a table and returns a value for each group. This is the syntax for group functions. The GROUP BY clause comes after the WHERE condition and before the ORDER BY clause. Everything that is enclosed in square brackets is optional and is used as needed. We will see some examples in the next slides. These are some of the group functions to achieve different functionalities. SUM, AVERAGE, COUNT, MAX and MIN, VARIANCE and standard deviation. SUM returns the sum of all n values. AVG returns the average of n values in a table. Max and min return maximum and minimum values within a group of values pulled by an expression. Let's take a look at few examples. If I give SELECT SUM of salary FROM emp_tab, and I run this, it gives me the sum of all salaries…

Contents