Tag archive
Commands grouped around the same concept, pattern, or recurring problem.
Use `IS NULL` and `IS NOT NULL` to filter rows based on whether a column has a value.
Match rows where two values are equal, treating two NULLs as equal instead of unknown.
Use an inclusive start and exclusive end to match a whole date range without missing rows that include times.
Put right-table filters in the `ON` clause when you want to keep unmatched left-side rows.
Use each engine's JSON path syntax in a `WHERE` clause to keep only rows whose JSON column contains a matching value.
Match string columns against a wildcard pattern using `LIKE`.
Use `IN` to match a column against a list of values in a single `WHERE` clause.
Return only rows that match a condition, with explicit ordering for stable output.
Use `BETWEEN` to match rows where a column falls within an inclusive lower and upper bound.
Compare normalized text values with LOWER or UPPER so matching does not depend on stored capitalization.
Use a `WHERE` predicate to list rows that already break a business or constraint rule.
Use `(col_a, col_b) IN ((v1, v2), (v3, v4))` to filter on combinations of columns simultaneously — cleaner and less error-prone than chaining `AND`/`OR` conditions.
Use a subquery in the `WHERE` clause of an `UPDATE` to restrict which rows are modified based on data from another table.
`WHERE` filters individual rows before grouping. `HAVING` filters grouped results after aggregates are computed.