typestar

DISTINCT values in SQL

DISTINCT collapses duplicate rows down to one each.

SELECT DISTINCT
    country,
    plan
FROM subscriptions
ORDER BY country;

How it works

  1. It applies to the whole selected row, not one column.
  2. Handy for asking what values a column actually contains.

Keywords and builtins used here

The run, in numbers

Lines
5
Characters to type
66
Tokens
11
Three-star pace
70 tpm

At the three-star pace of 70 tokens a minute, this run takes about 9 seconds.

Type this snippet

Step 5 of 5 in Selecting rows, step 5 of 23 in Language basics.

← Previous Next →