Just like PivotTables, SQL can also aggregate tables in their entirety or grouping by specific columns.
The dbfiddle website can be accessed for free and without an account at:
https://dbfiddle.uk/
Make sure to use the SQL Server dialect and the AdventureWorks sample database to be able to follow along with these examples!
---------------------------------------------------
This is part of the From Excel to SQL playlist, available at:
• From Excel to SQL
Check out the previous video at:
• From Excel to SQL - Date Formatting (FORMAT)
...and the next video at:
• From Excel to SQL - Pivot Tables (ROLLUP)
The written version of this content is also available at:
https://billwallis.github.io/sql-lear...
---------------------------------------------------
CHAPTERS
00:00 dbfiddle
00:28 Intro
01:16 Aggregate functions in Excel
02:55 Aggregate functions in SQL
06:02 Better example (Excel)
09:49 Better example (SQL)
11:50 Aggregates over groups in Excel (PivotTable)
12:53 Aggregates over groups in SQL (GROUP BY)
15:21 Aggregating over multiple columns
17:12 Styling PivotTables like the SQL output
17:47 Full worked example
21:55 Warning: you can't use column aliases
22:45 Using FORMAT for cleaner aggregates
23:52 Using HAVING
25:43 The order of the special words
26:06 Different ways to use COUNT()
29:09 Wrap up