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
fr French Download
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,420 --> 00:00:06,020 In the last video, we learned how to retrieve data from a table. 2 00:00:06,730 --> 00:00:11,170 But when we were retrieving the data, all the data from the table was coming. 3 00:00:12,270 --> 00:00:19,440 And even if our table had duplicate values, say, for example, if two or more customers had the same 4 00:00:19,440 --> 00:00:22,770 first name, it would have appeared multiple times. 5 00:00:23,130 --> 00:00:31,200 So to get rid of these duplicate values and to get only unique value, we need to use the distinct keyword 6 00:00:31,200 --> 00:00:32,910 with the select command. 7 00:00:34,560 --> 00:00:40,380 Distinct keyword will eliminate all the duplicate records and it will fetch only unique records. 8 00:00:41,070 --> 00:00:43,140 This is the syntax for distinct command. 9 00:00:43,650 --> 00:00:44,790 Select this thing. 10 00:00:45,360 --> 00:00:52,230 Mention the column names one or more and then write the keyword from and mention the table name. 11 00:00:53,590 --> 00:00:54,760 Let us see an example. 12 00:00:56,170 --> 00:01:00,010 To retrieve only a single column with customer's first name. 13 00:01:00,250 --> 00:01:04,240 We will select distinct customer first name from the customer table. 14 00:01:04,960 --> 00:01:11,380 To get multiple columns, we will write first name and age and get it from the customer table. 15 00:01:11,410 --> 00:01:15,220 Let us go and write this in dpkg admin window. 16 00:01:15,940 --> 00:01:16,630 Right now. 17 00:01:16,630 --> 00:01:21,490 If I do select start from customer table if I run the last query. 18 00:01:24,340 --> 00:01:27,390 So overall, there is no duplicate value in our table. 19 00:01:27,400 --> 00:01:35,530 But if you look at only the first name column, there is a g value three times out of which to have 20 00:01:35,530 --> 00:01:39,550 the same case, and the third one has a different case. 21 00:01:40,060 --> 00:01:43,690 So if I want to get only the unique first names. 22 00:01:44,700 --> 00:01:45,310 I'll write. 23 00:01:45,330 --> 00:01:47,520 I'll need to use the distinct keyword. 24 00:01:47,550 --> 00:01:48,220 Let us write. 25 00:01:48,240 --> 00:01:50,220 Select, distinct. 26 00:01:58,820 --> 00:01:59,630 First name. 27 00:02:00,830 --> 00:02:01,520 From. 28 00:02:03,090 --> 00:02:04,090 The customer table. 29 00:02:09,460 --> 00:02:12,430 Take a moment to guess what will be the result of this query. 30 00:02:13,660 --> 00:02:15,820 And now let us run this query. 31 00:02:20,830 --> 00:02:22,210 So did you get it correctly? 32 00:02:22,960 --> 00:02:25,990 It is giving us only six values back. 33 00:02:27,000 --> 00:02:29,340 Two of the duplicate values have been removed. 34 00:02:30,030 --> 00:02:34,170 You can see there are two different genes still in the retrieved data. 35 00:02:35,530 --> 00:02:38,250 But these two are different in their case. 36 00:02:38,260 --> 00:02:41,410 That is why both these are present in the data. 37 00:02:41,920 --> 00:02:46,030 So let us compare this with the select query without the distinct keyword. 38 00:02:55,160 --> 00:02:56,810 This will make it easier to compare. 39 00:03:02,320 --> 00:03:05,770 You can see there are eight entries in the first name. 40 00:03:06,340 --> 00:03:09,100 There were two GS and two JS. 41 00:03:10,090 --> 00:03:15,310 One of the J has been removed and one of the G has been removed. 42 00:03:16,510 --> 00:03:17,470 So that is how. 43 00:03:18,450 --> 00:03:24,360 Distinct keyword helps us identify the unique value while retrieving the data. 44 00:03:26,000 --> 00:03:30,210 Now let us try to retrieve more than one column from the database. 45 00:03:30,230 --> 00:03:34,100 We will select distinct first name. 46 00:03:36,750 --> 00:03:38,040 And age. 47 00:03:40,920 --> 00:03:42,360 From the customer table. 48 00:03:47,890 --> 00:03:48,960 And then this query. 49 00:03:52,500 --> 00:03:55,830 We get only the distinct values back. 50 00:03:57,960 --> 00:04:01,500 Let us see what happens if we run select distinct star. 51 00:04:05,660 --> 00:04:06,830 Customer table. 52 00:04:10,010 --> 00:04:10,550 Gun. 53 00:04:13,820 --> 00:04:21,950 So you can see the fifth and seventh record have all the value same except the customer ID. 54 00:04:23,600 --> 00:04:29,660 Due to this mismatch of customer ID select distinct was not able to remove this duplicate value. 55 00:04:29,960 --> 00:04:33,080 It removes only exact duplicate rows. 56 00:04:33,800 --> 00:04:37,430 So let us see by adding an exact duplicate row. 57 00:04:38,540 --> 00:04:41,330 We will rerun the copy statement from above. 58 00:04:50,340 --> 00:04:53,610 This will add the two rows again. 59 00:04:56,200 --> 00:05:00,190 We will run a select start statement once to see if the. 60 00:05:03,480 --> 00:05:04,860 Two entries are added. 61 00:05:09,810 --> 00:05:15,420 You can see we now have two more entries, and these two entries are exactly same. 62 00:05:15,420 --> 00:05:19,890 So the fifth and six entry and the nine and ten and three are exactly same. 63 00:05:20,580 --> 00:05:25,140 Now let us do select distinct start on the customer table. 64 00:05:29,330 --> 00:05:38,090 The two new records that we added, which are exactly similar to the earlier ones, will now be removed. 65 00:05:38,480 --> 00:05:39,860 Those will not be retrieved. 66 00:05:42,190 --> 00:05:45,100 So you see, we have eight records now. 67 00:05:46,760 --> 00:05:49,130 So that is all with the distinct keyword. 68 00:05:49,670 --> 00:05:55,280 So in this video, we learned how to get unique data retrieved from the database. 69 00:05:56,480 --> 00:05:58,040 So see you in the next lecture. 70 00:05:58,160 --> 00:06:04,190 In the next video we will cover the web command, which is used to filter out the unwanted data from 71 00:06:04,190 --> 00:06:05,120 the retrieved data. 6211

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