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. - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Introduction to joins5m 2s
-
(Locked)
Inner join explained7m 9s
-
(Locked)
Left and right joins explained7m 18s
-
(Locked)
Full outer joins10m 41s
-
(Locked)
Using the UNION operator9m 2s
-
(Locked)
Using the CASE statement for conditional logic7m 12s
-
(Locked)
Using GROUP BY to aggregate data8m 52s
-
(Locked)
Common aggregation functions: SUM, AVG, COUNT, etc.6m 38s
-
(Locked)
Filtering GROUP BY results with the HAVING clause7m 52s
-
(Locked)
Challenge: Joins37s
-
(Locked)
Solution: Joins1m 49s
-
(Locked)
-
-
-
-
-
-
-
-
-