Aggregate functions bring your data to life.<\/p>\n\n\n\n
They allow you to take a standard table and use a function or two to build metrics and answer questions about the data. If you are familiar with\u00a0Pivot Tables\u00a0or\u00a0Excel Functions<\/a>\u00a0the terminology is similar and you’ll be up and running in no time.<\/p>\n\n\n\n
Introduction<\/a>
COUNT all the things<\/a>
COUNT DISTINCT<\/a>
GROUP BY<\/a>
ORDER BY<\/a>
GROUP BY multiple columns<\/a>
HAVING<\/a>
Types of Functions available<\/a><\/p><\/blockquote>\n\n\n\n
\n\n\n\nIntroduction to aggregate functions<\/h2>\n\n\n\n
In this example, I’m going to be using a subset of the Billboard Top 100 dataset, available on\u00a0Kaggle<\/a>. I grew up in the 90s so I’ve loaded the 90s rows into a table called music_charts in\u00a0SQL Server.<\/p>\n\n\n\n
First up, I’m going to look at what I’m dealing with:<\/p>\n\n\n\n
select top 10 *\n from dbo.music_charts<\/code><\/pre>\n\n\n\n