Tag archive
Commands grouped around the same concept, pattern, or recurring problem.
Use `CASE WHEN` inside `SUM` or `COUNT` to produce multiple metrics from a single pass over grouped data.
Measure how many unique users completed each stage of a multi-step flow using `COUNT(DISTINCT CASE WHEN event_name = '...' THEN user_id END)` per step.
Return the first non-null value from a list of expressions.
Evaluate conditions row-by-row inside a `SELECT` to produce computed columns based on branching logic.
Use `NULLIF` to convert a specific value to `NULL`, most commonly to prevent division-by-zero errors.
Set a column to different values depending on other column values in the same row by using `CASE WHEN` inside a `SET` clause.