## functions and expressions Aggregators ## count distinct ## count ## string operators ## data/time ## conditional # where `WHERE` limits the rows returned based on a condition. `WHERE` supports `>`, `<`, `=`, `!=`, `>=`, `<=`, the boolean operators, `BETWEEN` and `LIKE`. ## boolean operators Link multiple conditions with `AND`, `OR`. Use parentheses to define (and communicate to others) the order of operations. ## between Use `BETWEEN` with `AND` like `BETWEEN '2025-01-01' AND '2025-01-31' . Note that between is inclusive. ## like `LIKE` allows for fuzzy matching of character strings. Use the wildcard `%` to represent any number of any character and `_` to represent exactly one character. Match string should be wrapped in single quotes. [[join]] # group by Use `GROUP BY` to calculate aggregations on columns. Each column or expression in the `SELECT` statement not in the `GROUP BY` clause must be in a group function (e.g., `SUM`). The `GROUP BY` function calculates after the `WHERE` condition is evaluated. Use `SUM`, `AVG`, `COUNT`, `MIN`, `MAX` to calculate statistics on grouped rows by passing the function and column name in the `SELECT` statement. `COUNT(*)` will count records. `COUNT(<column>)` will return the number of non-null values in a column. `COUNT(Distinct <column>)` will return number of unique values. # having `HAVING` is the equivalent of `WHERE` for an interim answer set, such as one resulting from a `GROUP BY` clause. # order by `ORDER BY` orders the results. Use `ASC` for ascending, `DESC` for descending. A column number can be provided to order by a specific column from the SELECT statement, otherwise the first column will be used. ```SQL -- descending order by column 2 in the SELECT statement ORDER BY 2 DESC ```