W10 Flashcards
AVG()
Returns a column’s average value
SUM()
Returns the sum of a column’s values
MAX()
Returns a column’s highest value
MIN()
Returns a column’s lowest value
COUNT()
Returns the number of rows in a column
Summary Queries
Summary queries are queries that contain one or more aggregate functions.
Aggregate Functions
operate on a set of rows to calculate and return a single value.
GROUP BY
The GROUP BY clause is used when you have an aggregate function that you want to use on the grouped data.
HAVING
This clause also works with aggregate functions and allows you to filter the groups. It works a lot like the WHERE clause but the WHERE clause filters rows and the HAVING clause filters groups.
ROLLUP
This operator can be used with grouping and aggregates allowing you to add one or more summary rows to your results.
SELECT clause order
SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY
LIMIT
SELECT order of execution
FROM
WHERE
GROUP BY
HAVING
SELECT
ORDER BY
LIMIT