Aggregate functions in SQL allows you to perform a calculation on a set of values from your tables but return a single value as output. Learn about the purpose of various aggregate functions in SQL such as MAX, MIN, SUM, AVG, and COUNT.
- Aggregate functions in SQL allows you to perform calculation on a set of values and return a single value as the output. These aggregate functions are often used alongside a Group By clause, which allows you to partition your tables into individual categories based on one or more columns. So, for example, say that your Employees table has a Dept ID column and a Salary column. For each employee, showing the department ID to which this employee is assigned and the salary for that employee, and say that in your query you want to see the highest earning employee in each department but only the highest earning employee.
So in order to accomplish that, your SQL query will first have to segment the Employees table into individual partitions or groups based on the Department ID column and then for each set of rows that belong to a specific department ID, produce one row showing only the highest earning employee. So we can do that using the Max Aggregate Function on the Salary column, grouping by Department ID.
We'll see examples later in our chapter. There are many aggregate functions that exist as part of the SQL language in Oracle. Some of them are Avg or average, showing the average value for a set of rows, Count, which basically counts the number of records in a given set of rows or a group, Min and Max which shows you the minimum value and maximum value, and Sum, which summarizes the values in a column for a specific set of rows.
We'll see these functions in action later in our chapter.
Note: This training course is appropriate for beginning database developers with no prior experience with SQL or Oracle.
- Using Oracle SQL*Developer, the free development environment
- Selecting data from tables
- Filtering data
- Using functions to manipulate data
- Joining data from tables
- Creating tables
- Updating values
- Truncating data
- Grouping and ordering result sets
- Working with primary keys
- Checking constraints
Skill Level Beginner
Oracle 12c Database: Administrationwith David Yahalom3h 58m Beginner
Database Foundations: Core Conceptswith Adam Wilbert2h 14m Beginner
Database Foundations: Administrationwith Adam Wilbert1h 14m Beginner
1. Introduction to SQL
2. Preparing the Course Environment
Downloading the course VM2m 16s
3. Using Oracle SQL Developer
4. Basic SELECT Queries
5. String, Number, and Date Functions
6. Joining Table Data
7. Manipulating Data
8. Grouping Data
9. Advanced Topics
Next steps1m 33s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.