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 `NULLS FIRST` or `NULLS LAST` to explicitly position NULL values at the top or bottom of a sorted result set.
Normalize empty or whitespace-only text values to `NULL` with `NULLIF(TRIM(...), '')`.
Convert strings to numbers (or other types) while returning `NULL` for values that cannot be converted, instead of raising an error that aborts the query.
Audit a table for `NULL` values by counting how many rows have no value in each column of interest.
Return rows from one table that have no corresponding row in a second table using a LEFT JOIN with a NULL check.
Use a `LEFT JOIN` and filter for `NULL` on the joined table to find missing relationships.
Return the first non-null value from a list of expressions.
Use `NULLIF` to convert a specific value to `NULL`, most commonly to prevent division-by-zero errors.
`COUNT(column)` skips `NULL` values, while `COUNT(*)` counts every row that made it into the result set.
Filter `NULL` values out of the right side before using `NOT IN`, or the predicate can exclude everything.