Tag archive
Commands grouped around the same concept, pattern, or recurring problem.
Count only the distinct values in a column, ignoring duplicates.
Use `DISTINCT` to remove duplicate rows from a result set.
Use PostgreSQL's `DISTINCT ON (col)` to keep only the first row for each unique value of a column, with `ORDER BY` controlling which row within each group is considered first.