From the course: Oracle Database 12c: Basic SQL

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Using GROUP BY with MAX, MIN, and AVG

Using GROUP BY with MAX, MIN, and AVG - Oracle Database Tutorial

From the course: Oracle Database 12c: Basic SQL

Start my 1-month free trial

Using GROUP BY with MAX, MIN, and AVG

- [Narrator] There are additional aggregation functions we can use in combination with the group by clause, for example, let's say we want to see the average salary for employees based on each department in our company. To accomplish that I can type select average salary comma department id from employees group by department id. Executing this query will show us the average salary per each department. Note that I can get rid of these very precise, but not so readable numbers by rounding the output. I can nest functions together, such as placing the average function inside a round function. Executing the statement again, in this manner will give me much more readable output. I can also combine multiple aggregation functions together in the same statement. For example, in addition to showing the average salary, let's also see the minimum salary for the lowest earning employee in each department. To accomplish that I'll type min salary comma department id and execute the query. Note that…

Contents