Muller Unlimited

View Original

October 12, 2019

SQL Aggregate Functions

COUNT() - count the number of rows

SUM() - the sum of the values in a column

MAX() / MIN() - the largest / smallest value

AVG() - the average of the values

ROUND() - round the values in the column - ROUND(price, 2) rounds price to 2 decimal places

GROUP BY - groups the data. Most be used in aggregate functions

HAVING - HAVING COUNT(name) > 10 - limits the results of the query based on an aggregate property
- comes after GROUP BY, but before ORDER BY and LIMIT