Aggregate Functions in SQL

Functions like sql count(), sum(), avg(), min() and max() are some aggregate functions in sql or scalar functions in mysql are the ones that provide aggregated values i.e. value grouped together of a particular column or a sub-set of that column.

Table 1

aggregate functions in sql
aggregate functions in sql

SQL Count()

select count(*) from table 1;

Result:

Returns the count of the above Table 1 i.e. 7.

Sum()

Select sum(age) from Table1;

Result:

Returns the sum of all the values of the age column.

Avg()

Select avg(age) from Table1;

Result:

Returns the average of all the values of the age column.

Min()

Select min(age) from Table1;

Result:

Returns the minimum value of all the values of the age column i.e. 57.

Max()

Select max(age) from Table1;

Result:

Returns the maximum value of all the values of the age column i.e. 103.

Conclusion:

So, you can use these aggregate functions by applying certain filters as well over them like in sql count function:

Select count(*) from Table1 where age < 50;

So, the above query will count only those rows where the age is less than 50.

Similarly, same can be applied which working with other aggregate functions as well

Apart, from our this article do visit our Homepage for tutorials on Google Sheets functions, General Knowledge quizzes etc.

Visit our Youtube channel for Google Sheets related tutorials in Hindi.

Leave a Comment