Menu
Coddy logo textTech

Unique values

Part of the Fundamentals section of Coddy's SQL journey — lesson 4 of 72.

Let's assume we have the following table:

sales

 countrycityamount
1PolandWarsaw13
2GermanyBerlin24
3PolandKatowice56

And we would like to know all of the countries where the product was sold.

If we use the normal query we know: SELECT country from sales it will return Poland, Germany, Poland. This is not what we are looking for because Poland is repeated twice.

To solve it we can use the DISTINCT keyword:

SELECT DISTINCT country FROM sales
challenge icon

Challenge

Easy

Available tables and columns:

  • <strong>sales</strong>: <strong>coin</strong>, <strong>amount</strong>

Fetch all of the unique coins that were used in the sales table

Try it yourself

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals