From the course: Complete Guide to SQL for Data Engineering: from Beginner to Advanced

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Common aggregation functions: SUM, AVG, COUNT, etc.

Common aggregation functions: SUM, AVG, COUNT, etc. - SQL Tutorial

From the course: Complete Guide to SQL for Data Engineering: from Beginner to Advanced

Common aggregation functions: SUM, AVG, COUNT, etc.

- [Instructor] Aggregate function effectiveness comes along with the GROUP BY. Similarly, GROUP BY will become more effective when we use aggregate functions along with it. So aggregate function and GROUP BY goes hand in hand. There are couple of common aggregate functions, like COUNT, SUM, AVERAGE, MAX, MIN, STDDEV. Now let's just go to our pgAdmin and see how we can use all these aggregate functions and what they do. Now let me open another sheet. Let's say for example, first, we use our COUNT aggregate function. We can say select count(*) from customer table. Now, what it will do is it will try to give me the total row count for this customer table. In case if I don't give any alias, you can see that the result comes like count and the count number is six. In a more readable manner, I can say count(*) as Total_Row_Count. Now you will get an output which is having more readability. It's giving a proper column name…

Contents