Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
SQL Distinct | Database & Introduction to Syntax
SQL Tutorial for Beginners
course content

Зміст курсу

SQL Tutorial for Beginners

SQL Tutorial for Beginners

1. Database & Introduction to Syntax
2. SQL Aggregate Functions
3. Filtering Statements

SQL Distinct

Distinct is a keyword used with SELECT to return only unique values. Usually, you want to get all unique values, but there are duplicate values stored in the tables.

Check the difference: in our table, there are 18 records at all, and each record has a singer. You'll retrieve the 18 singers with the next query:

12
SELECT singer FROM songs
copy

But some singers, for example, AC/DC, occur multiple times. To retrieve the unique singers, use the DISTINCT keyword before the singer column:

12
SELECT DISTINCT singer FROM songs
copy

Now there are no repeated values, so you can see that the total number of unique singers is 10.

Завдання

Find all unique title values in songs.

Завдання

Find all unique title values in songs.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 4
toggle bottom row

SQL Distinct

Distinct is a keyword used with SELECT to return only unique values. Usually, you want to get all unique values, but there are duplicate values stored in the tables.

Check the difference: in our table, there are 18 records at all, and each record has a singer. You'll retrieve the 18 singers with the next query:

12
SELECT singer FROM songs
copy

But some singers, for example, AC/DC, occur multiple times. To retrieve the unique singers, use the DISTINCT keyword before the singer column:

12
SELECT DISTINCT singer FROM songs
copy

Now there are no repeated values, so you can see that the total number of unique singers is 10.

Завдання

Find all unique title values in songs.

Завдання

Find all unique title values in songs.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 4
toggle bottom row

SQL Distinct

Distinct is a keyword used with SELECT to return only unique values. Usually, you want to get all unique values, but there are duplicate values stored in the tables.

Check the difference: in our table, there are 18 records at all, and each record has a singer. You'll retrieve the 18 singers with the next query:

12
SELECT singer FROM songs
copy

But some singers, for example, AC/DC, occur multiple times. To retrieve the unique singers, use the DISTINCT keyword before the singer column:

12
SELECT DISTINCT singer FROM songs
copy

Now there are no repeated values, so you can see that the total number of unique singers is 10.

Завдання

Find all unique title values in songs.

Завдання

Find all unique title values in songs.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Distinct is a keyword used with SELECT to return only unique values. Usually, you want to get all unique values, but there are duplicate values stored in the tables.

Check the difference: in our table, there are 18 records at all, and each record has a singer. You'll retrieve the 18 singers with the next query:

12
SELECT singer FROM songs
copy

But some singers, for example, AC/DC, occur multiple times. To retrieve the unique singers, use the DISTINCT keyword before the singer column:

12
SELECT DISTINCT singer FROM songs
copy

Now there are no repeated values, so you can see that the total number of unique singers is 10.

Завдання

Find all unique title values in songs.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 4
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt