answersLogoWhite

0

Aggregate FunctionsMINreturns the smallest value in a given columnMAXreturns the largest value in a given columnSUMreturns the sum of the numeric values in a given columnAVGreturns the average value of a given columnCOUNTreturns the total number of values in a given columnCOUNT(*)returns the number of rows in a table

Aggregate functions are used to compute against a "returned column of numeric data" from your SELECT statement. They basically summarize the results of a particular column of selected data. We are covering these here since they are required by the next topic, "GROUP BY". Although they are required for the "GROUP BY" clause, these functions can be used without the "GROUP BY" clause. For example:

SELECT AVG(salary)

FROM employee;

This statement will return a single result which contains the average value of everything returned in the salary column from the employee table.

Another example:

SELECT AVG(salary)

FROM employee;

WHERE title = 'Programmer';

This statement will return the average salary for all employees whose title is equal to 'Programmer'

Example:

SELECT Count(*)

FROM employees;

This particular statement is slightly different from the other aggregate functions since there isn't a column supplied to the count function. This statement will return the number of rows in the employees table

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor

Add your answer:

Earn +20 pts
Q: What are aggregate function in sql explain any 5 aggregate function with example?
Write your answer...
Submit
Still have questions?
magnify glass
imp