From Excel to SQL - Aggregations (GROUP BY)
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: - https://www.youtube.com/playlist?list=PLEiRgvTilK5rhnVPQ_Tj3Q-CI0rGn_uiD Check out the previous video at: - https://youtu.be/gYjYLL99jaQ ...and the next video at: - https://youtu.be/65EFEtjYL9E The written version of this content is also available at: - https://billwallis.github.io/sql-learning-materials/from-excel-to-sql/main-concepts/group-by/ --------------------------------------------------- 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
Download
0 formatsNo download links available.