Basic Aggregate Functions in SQL (COUNT, SUM, AVG, MAX, and MIN)

Опубликовано: 29 Сентябрь 2024
на канале: Becoming a Data Scientist
88,145
1.9k

Learn how to use SQL's basic aggregation functions like COUNT, SUM, AVG, MAX, and MIN in this step-by-step tutorial!

Advanced SQL Aggregation Tutorial:    • Advanced Aggregate Functions in SQL (...  

Queries:
1) Get a count of all the rows: SELECT COUNT(*) FROM table
2) Get a SUM of a column in all the rows: SELECT SUM(column1) FROM table
3) Get the maxium number in a column: SELECT MAX(column1) FROM table
4) Get the minimum number in a column: SELECT MIN(column1) FROM table
5) You can also do arithmatic with these aggregate functions: SELECT MAX(column1)-MIN(column1) AS range FROM table
6) Or, like this: SELECT AVG(column1*column2) FROM table

Get the Northwind Database:    • How to Load a Sample PostgreSQL Datab...  

Support the Channel:
1) Subscribe:
2) DataCamp:
3) Udacity: