From the course: Oracle Database 12c: Basic SQL
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Using GROUP BY - Oracle Database Tutorial
From the course: Oracle Database 12c: Basic SQL
Using GROUP BY
- [Instructor] The group by sequel syntax which is often combined with certain aggregate functions such as COUNT MAX SUM MEAN or AVERAGE is used to group the result set from our query based on one or more columns. Let's see a very simple example of using group by in a select statement. In our example, we simply want to count how many employees have been assigned to each one of our departments. So in order to accomplish that we'll type select count and then inside parenthesis we'll just type the star character comma and department id from our employees table group by, this is where the new syntax comes into play, department id. Essentially telling oracle to count the number of rows in our table in groups. And we perform the group by using the department id column. So that you can see that we have six employees assigned to department id 100 and another six employees assigned to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.