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

Conteúdo do Curso

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.

Tarefa

Find all unique title values in songs.

Tarefa

Find all unique title values in songs.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 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.

Tarefa

Find all unique title values in songs.

Tarefa

Find all unique title values in songs.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 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.

Tarefa

Find all unique title values in songs.

Tarefa

Find all unique title values in songs.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

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.

Tarefa

Find all unique title values in songs.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 4
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt