Removing duplicates with DISTINCT
◈ 2 cardsGet the set of distinct values in a column.
The distinct values
Many books share a genre. To get each genre once, use DISTINCT:
SELECT DISTINCT genre FROM books;
DISTINCT removes duplicate rows from the result. With several columns it dedupes on the whole row — SELECT DISTINCT genre, author_id gives each distinct pair.