All language subtitles for 8. SELECT DISTINCT

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In the last video, we learned how to retrieve data from a table.

But when we were retrieving the data, all the data from the table was coming.

And even if our table had duplicate values, say, for example, if two or more customers had the same

first name, it would have appeared multiple times.

So to get rid of these duplicate values and to get only unique value, we need to use the distinct keyword

with the select command.

Distinct keyword will eliminate all the duplicate records and it will fetch only unique records.

This is the syntax for distinct command.

Select this thing.

Mention the column names one or more and then write the keyword from and mention the table name.

Let us see an example.

To retrieve only a single column with customer's first name.

We will select distinct customer first name from the customer table.

To get multiple columns, we will write first name and age and get it from the customer table.

Let us go and write this in dpkg admin window.

Right now.

If I do select start from customer table if I run the last query.

So overall, there is no duplicate value in our table.

But if you look at only the first name column, there is a g value three times out of which to have

the same case, and the third one has a different case.

So if I want to get only the unique first names.

I'll write.

I'll need to use the distinct keyword.

Let us write.

Select, distinct.

First name.

From.

The customer table.

Take a moment to guess what will be the result of this query.

And now let us run this query.

So did you get it correctly?

It is giving us only six values back.

Two of the duplicate values have been removed.

You can see there are two different genes still in the retrieved data.

But these two are different in their case.

That is why both these are present in the data.

So let us compare this with the select query without the distinct keyword.

This will make it easier to compare.

You can see there are eight entries in the first name.

There were two GS and two JS.

One of the J has been removed and one of the G has been removed.

So that is how.

Distinct keyword helps us identify the unique value while retrieving the data.

Now let us try to retrieve more than one column from the database.

We will select distinct first name.

And age.

From the customer table.

And then this query.

We get only the distinct values back.

Let us see what happens if we run select distinct star.

Customer table.

Gun.

So you can see the fifth and seventh record have all the value same except the customer ID.

Due to this mismatch of customer ID select distinct was not able to remove this duplicate value.

It removes only exact duplicate rows.

So let us see by adding an exact duplicate row.

We will rerun the copy statement from above.

This will add the two rows again.

We will run a select start statement once to see if the.

Two entries are added.

You can see we now have two more entries, and these two entries are exactly same.

So the fifth and six entry and the nine and ten and three are exactly same.

Now let us do select distinct start on the customer table.

The two new records that we added, which are exactly similar to the earlier ones, will now be removed.

Those will not be retrieved.

So you see, we have eight records now.

So that is all with the distinct keyword.

So in this video, we learned how to get unique data retrieved from the database.

So see you in the next lecture.

In the next video we will cover the web command, which is used to filter out the unwanted data from

the retrieved data.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.