×

sql · level 1 · unit 3 · lesson 3

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

shows each value only once.

Ask the scores table which games were played, and you get darts, darts, bowling, bowling, bowling, darts, darts. Each repeat is a , and they make the answer hard to read.

DISTINCT goes straight after SELECT. It throws away duplicate rows, so each one shows up only once. Here, that leaves darts and bowling.

With two columns, a row only counts as a duplicate when both of its values match another row.

SELECT DISTINCT game FROM scores;

DISTINCT works with ORDER BY too, so you can sort the list as well.