Oracle SQL in 10 Minutes - Asim Abbasi

CH1: SQL Basics | CH2:  SQL Operators | CH3:  SQL Built-in Functions | CH4: SQL Joins | CH5: UPDATE, INSERT & DELETE Statements | CH6: CREATE, ALTER & DROP Statements | CH7: Constraints | CH8: Linking Tables vs Joining Tables | CH9: SQL Statements for Other Database Objects | CH10: SQL Statements for Database Security

Chapter 3: SQL Built-in Functions

Page #: 1 | 2 | 3 | 4 | 5

 

Group Functions:

A group function as the name says, gets implemented on more than one record within a column. They can be better understood by looking at their real world examples. There are five very important group functions

AVG
COUNT
MAX
MIN
SUM
Example:

SELECT AVG(sal) "Average"
FROM emp;

Output:

Average
----------
2077.21429

Example:

SELECT COUNT(*) "Total"
FROM emp;

Output:

Total
----------
18

Total number of records will be returned with a table.

Example:

SELECT MAX(sal) "Maximum"
FROM emp;

Output:

Maximum
----------
5000

On the same line we can find out minimum value using the MIN group function.

Example:

SELECT SUM(sal) "Total"
FROM emp;

Output:

Total
----------
29081

 

Chapter 3: SQL Built-in Functions

Page #: 1 | 2 | 3 | 4 | 5

CH1: SQL Basics | CH2:  SQL Operators | CH3:  SQL Built-in Functions | CH4: SQL Joins | CH5: UPDATE, INSERT & DELETE Statements | CH6: CREATE, ALTER & DROP Statements | CH7: Constraints | CH8: Linking Tables vs Joining Tables | CH9: SQL Statements for Other Database Objects | CH10: SQL Statements for Database Security

Share with others: