Here’re six top SQL aggregate functions rules. Aggregate functions, you can call column functions since you can use only for Table columns.
Rules for Aggregate Functions
Example Function
The syntax.
AVG(SALARY)
Here SALARY is name of the column. Below is the list of rules.
#1 Rule
- A select query that uses Aggregate function called summary query.
#2 Rule
- The result of AVG and SUM functions is numeric. These functions only work with numerics.
#3 Rule
- The result of MIN, MAX and COUNT can be a numeric or DATE, or String value.
#4 Rule
- By default DUPLICATEs are considered. So use distinct to ignore duplicates.
#5 Rule
- You cannot mix aggregate and non-aggregate functions in SELECT statement. You need GROUP BY to mix both.
#6 Rule
- Aggregate functions ignore NULL values.
QUIZ
Try the tricky questions.
Related Posts