6 Rules of SQL Aggregate Functions

Aggregate functions, you can also call column functions. Because you can use these functions only for Table columns. Below are the rules of aggregate functions.


The syntax.

AVG(SALARY) – Here SALARY is name of the column. Below is the list of rules.

Rule-1

A select query that uses Aggregate function called summary query.

Rule-2

The result of AVG and SUM functions is numeric. These functions only work with numerics.

Rule-3

The result of MIN, MAX and COUNT can be a numeric or DATE, or String value.

Rule-4

By default DUPLICATEs are considered. So use distinct to ignore duplicates.

Rule-5

You cannot mix aggregate and non-aggregate functions in SELECT statement. You need GROUP BY to mix both.

Rule-6

Aggregate functions ignore NULL values.

QUIZ

Try the tricky questions.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.