All language subtitles for 4. Inner Join

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: 0 1 00:00:01,870 --> 00:00:03,700 So let us learn what is in a join. 1 2 00:00:05,090 --> 00:00:12,170 So Iner join will compare each row of both the tables and then find out the pros, which are satisfying the conditions 2 3 00:00:12,170 --> 00:00:19,280 that we have mentioned, once it is identified, the rows, it will provide us, the column values of both the 3 4 00:00:19,290 --> 00:00:22,140 tables that we have specified in this select statement. 4 5 00:00:22,670 --> 00:00:26,210 In other words, inner join, finds out the intersection first. 5 6 00:00:26,240 --> 00:00:32,990 So, for example, if you have a group which contains ABCD and you have another group which contains 6 7 00:00:32,990 --> 00:00:39,470 DEFG, if you find the inner join of these two groups, you'll find the intersection point, which is 7 8 00:00:39,470 --> 00:00:41,510 only D, which is present in both the groups. 8 9 00:00:42,530 --> 00:00:45,080 So this is inner join. With this graphic 9 10 00:00:45,080 --> 00:00:50,200 Also, you can see inner join is the shaded part, which is common between the two tables. 10 11 00:00:50,870 --> 00:00:56,420 So it will find out that shaded part first and then for that shaded part, it will give you the values of 11 12 00:00:56,420 --> 00:00:59,000 all the columns that you have mentioned in the select clause. 12 13 00:00:59,970 --> 00:01:06,900 Let us look at the syntax of this inner join, we will provide the column names in the select from table 13 14 00:01:07,050 --> 00:01:10,740 one, then we'll write inner join, table two. 14 15 00:01:11,980 --> 00:01:19,690 And then we will give the condition, the joint predicate, which is start with on, table one dot the column 15 16 00:01:19,690 --> 00:01:22,060 which we have to match table two column. 16 17 00:01:23,370 --> 00:01:28,350 When we are specifying the columns also, since there are two tables involved, we will need to specify 17 18 00:01:28,350 --> 00:01:30,640 the table also then the column name. 18 19 00:01:32,070 --> 00:01:34,350 Let us look at this from the example. 19 20 00:01:37,550 --> 00:01:47,440 Now, suppose in a table of sales where we have the sales of 2015, if I want to plot the name of the 20 21 00:01:47,440 --> 00:01:48,130 customer. 21 22 00:01:49,200 --> 00:01:54,470 And the age of the customer against each order line, how do I do that? 22 23 00:01:56,130 --> 00:01:57,630 Inner join will help me in that. 23 24 00:01:59,190 --> 00:02:01,050 So I will write select 24 25 00:02:02,160 --> 00:02:08,910 A dot order line. So a is an alias here for the table since 2015. 25 26 00:02:09,910 --> 00:02:17,020 If you remember, we assigned aliases to column names in the video titled AS, we are using the same 26 27 00:02:17,020 --> 00:02:26,590 AS keyword to now provide Alias to a table such as sales, 115 has been given alias of a and customer 27 28 00:02:26,590 --> 00:02:35,130 2060 has been given an alias of b. So when I'm writing these names, I can either write sales_2015 28 29 00:02:35,170 --> 00:02:44,680 dot order_line and then sales_2015 DOT product underscore id every time. 29 30 00:02:44,950 --> 00:02:51,910 Or I can just provide a short alias of a, and write a.orderline, a.product id 30 31 00:02:52,600 --> 00:02:53,240 and so on. 31 32 00:02:54,130 --> 00:03:02,190 So I want the order line, product id, customer id, the sales value and the customer name and customer 32 33 00:03:02,200 --> 00:03:02,650 age. 33 34 00:03:03,780 --> 00:03:07,320 So all these six columns are part of my select clause. 34 35 00:03:08,270 --> 00:03:13,190 From has table one name inner join table two name. 35 36 00:03:14,630 --> 00:03:21,650 On this will be the condition, which will be matched with both the table, So it will be a dot customer id 36 37 00:03:21,770 --> 00:03:23,930 is same as b dot customer id 37 38 00:03:24,260 --> 00:03:30,230 So the customer is same in both the tables, only when this condition is met, all these six values 38 39 00:03:30,230 --> 00:03:33,860 will be taken out and provided to us in the ResultSet. 39 40 00:03:34,890 --> 00:03:40,110 And will be ordering this by the customer id, let us go and write this in the pgAdmin. 40 41 00:03:47,140 --> 00:03:48,220 So we will select. 41 42 00:03:49,830 --> 00:03:54,110 From the first table, we want the orderline 42 43 00:03:58,760 --> 00:04:07,080 I'll correct spelling of order, then a dot product id 43 44 00:04:10,380 --> 00:04:11,940 then a dot customer id. 44 45 00:04:16,590 --> 00:04:18,300 Then a dot sales 45 46 00:04:22,940 --> 00:04:29,900 B dot customer name and b.age 46 47 00:04:33,380 --> 00:04:40,580 These are the six columns now, I'll specify the table name from table 1. Table 1is 47 48 00:04:44,340 --> 00:04:47,400 Sales 2015 As a 48 49 00:04:50,400 --> 00:04:50,710 inner join 49 50 00:04:56,520 --> 00:05:05,450 table 2 name customer_20_60 under 60 as we. 50 51 00:05:09,330 --> 00:05:16,160 On a .customer id is equal to b.customer id 51 52 00:05:22,420 --> 00:05:23,080 Order by 52 53 00:05:26,200 --> 00:05:26,740 customer id 53 54 00:05:32,800 --> 00:05:34,180 So select this query and run it. 54 55 00:05:39,350 --> 00:05:45,980 So you can see that I have got the order line, product id, customer id and sale value form the 55 56 00:05:45,980 --> 00:05:55,330 first table, which is the sales table and customer name and age from the customer table where customer 56 57 00:05:55,340 --> 00:05:57,140 id is same in both cases. 57 58 00:05:58,720 --> 00:06:06,280 So just to confirm that the result in table is actually intersection of both the tables, we will find 58 59 00:06:06,280 --> 00:06:12,250 out some particular customer IDs, which are not part of any one of the tables and confirm that they 59 60 00:06:12,250 --> 00:06:14,030 are not part of the result. 60 61 00:06:14,080 --> 00:06:19,750 table also. So let us find out the customer IDs in the sales table. 61 62 00:06:24,990 --> 00:06:29,710 So let us remember, 10315 and 10375 62 63 00:06:30,060 --> 00:06:36,410 These two customer Ids are in the sale table. Now if I run the second select statement. 63 64 00:06:39,240 --> 00:06:43,950 So if you remember, one zero three one five is missing in the customer table. 64 65 00:06:45,590 --> 00:06:50,360 10375 is in the customer table, so it should be present in the intersection also. 65 66 00:06:53,360 --> 00:06:55,970 Let's run the query that we created earlier. 66 67 00:06:57,500 --> 00:07:03,350 So you can see one zero three one five is missing from this table, so it was part of only one table, 67 68 00:07:04,100 --> 00:07:08,510 but one zero three seven five is part of this table since it was present in both the tables. 68 69 00:07:09,230 --> 00:07:11,960 So this is giving us the intersection of the two tables 69 70 00:07:12,650 --> 00:07:17,660 Similarly, we can find another customer, right, which is part of the customer table, but not part 70 71 00:07:17,660 --> 00:07:18,480 of the sales table. 71 72 00:07:19,190 --> 00:07:25,610 So, for example, this one zero for the customer is part of customer table. 72 73 00:07:27,200 --> 00:07:32,170 And let us see in the sales table, I think this is missing in this table. 73 74 00:07:32,630 --> 00:07:40,670 So 10480 customer id we will check if it is present in the inner join table. 74 75 00:07:44,890 --> 00:07:52,330 So you can see one zero four eight zero is missing from this table since it was written in only the 75 76 00:07:52,330 --> 00:07:57,820 second table , this confirmed that it is giving only the intersection part of the two tables. 76 77 00:07:59,150 --> 00:08:01,700 That is inner join for you. In the next election. 77 78 00:08:01,720 --> 00:08:03,440 We will look at Left join. 8159

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