All language subtitles for 8. Cross Join

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 0 1 00:00:01,700 --> 00:00:06,980 So let us now discuss the cross join. Cross join gives us the Cartesian product between two sets 1 2 00:00:06,980 --> 00:00:07,470 of data. 2 3 00:00:07,880 --> 00:00:09,070 What is the cartesian product? 3 4 00:00:09,230 --> 00:00:16,310 So it takes both the tables, So every row in table a, it will map all the values in table b 4 5 00:00:16,910 --> 00:00:20,480 then again, it will go to the next row of table a and it will map 5 6 00:00:20,480 --> 00:00:21,890 All the rows of table b. 6 7 00:00:21,920 --> 00:00:26,210 So for all values in table a, it will map all values in table b. 7 8 00:00:26,540 --> 00:00:29,570 So when we will discuss an example, it'll become more clear to you. 8 9 00:00:29,750 --> 00:00:32,890 This join does not have the same syntax as other joins. 9 10 00:00:32,990 --> 00:00:36,890 in other join we were writing as inner join, outer join left and right join. 10 11 00:00:37,310 --> 00:00:42,580 This is just mentioning the two table names from table one and table 2. 11 12 00:00:42,590 --> 00:00:46,250 And if there are other tables, also then table three, four and so on. 12 13 00:00:47,760 --> 00:00:55,710 So the syntax is select, table name.column name and so on from table name and the other names. 13 14 00:00:58,060 --> 00:01:02,260 As an example for crossjoin, I have created two different tables. 14 15 00:01:02,650 --> 00:01:04,820 One is the year values table. 15 16 00:01:05,020 --> 00:01:11,800 This table contains some set of years and the other is the month values table, which contains the 12 16 17 00:01:11,800 --> 00:01:12,610 months of a year. 17 18 00:01:13,210 --> 00:01:20,470 What I'm doing by cross joining these two tables is when I do a join for each year, I'll get all the 18 19 00:01:20,470 --> 00:01:22,270 12 months mapped against it. 19 20 00:01:22,810 --> 00:01:27,230 So in the result set I get for every year, there'll be 12 months. 20 21 00:01:27,670 --> 00:01:32,640 So this will give me the total ResultSet of every month mapped against every year. 21 22 00:01:33,490 --> 00:01:37,300 So I have created this table of month values and year values. 22 23 00:01:38,580 --> 00:01:40,630 Using the create table function. Create table 23 24 00:01:41,610 --> 00:01:49,290 command, then, I inserted 12 values of the month in the month values table using the insert value command 24 25 00:01:50,390 --> 00:01:51,270 Then I have entered. 25 26 00:01:52,240 --> 00:02:00,260 Nine years in the year values, using the insert into command, if you run the the select star on month 26 27 00:02:00,280 --> 00:02:03,190 values, you will see the 12 months. 27 28 00:02:03,640 --> 00:02:08,890 If you run select start on year values, you will see nine years. 28 29 00:02:10,310 --> 00:02:18,000 Suppose in a table you want each year and in each year you want to map the 12 months, it will take 12 29 30 00:02:18,040 --> 00:02:19,650 into 9 rows. 30 31 00:02:19,660 --> 00:02:23,140 So you would have to enter values into 10 rows. 31 32 00:02:24,210 --> 00:02:28,660 Instead of doing that, we entered value into only 12 plus nine. 32 33 00:02:28,690 --> 00:02:29,910 rows which is 21. 33 34 00:02:31,000 --> 00:02:41,560 And we then write the cross join. Let us write cross join after the cross join we will get those 34 35 00:02:41,560 --> 00:02:42,340 108 rows. 35 36 00:02:43,420 --> 00:02:51,940 So a.b yyy column and the b.month column. 36 37 00:02:52,360 --> 00:02:55,990 So here a will be our year table 37 38 00:02:58,690 --> 00:03:01,330 and b will be the month table. 38 39 00:03:06,530 --> 00:03:12,590 I think overall, this example is covering a lot of the other commands that we have discussed so far. 39 40 00:03:14,190 --> 00:03:15,610 So this will be a revision for you. 40 41 00:03:16,360 --> 00:03:24,490 We are creating a table inserting values, then using aliases and now we are also doing cross join 41 42 00:03:29,500 --> 00:03:34,570 When I ran this query, you see, for 2011, I have only 12 months mapped for 2012 42 43 00:03:35,140 --> 00:03:36,580 I have all the 12 months mapped. 43 44 00:03:37,870 --> 00:03:44,980 So this basically has 108 rows, if you had to create this manually, you would have to 44 45 00:03:45,160 --> 00:03:49,750 enter a lot of values, so this cross join helps you there 45 46 00:03:50,050 --> 00:03:55,480 Similarly, if you want dates also plotted against this, you can create another table with dates into 46 47 00:03:55,480 --> 00:04:02,490 it and then do a cross join with some conditions attached to it. Cross join basically help to get this repetitive 47 48 00:04:02,530 --> 00:04:03,520 data easily. 48 49 00:04:04,600 --> 00:04:06,250 So we have covered all the joins. 49 50 00:04:07,300 --> 00:04:13,300 Apart from this, since we are discussing, merging and joining, two tables will need to cover two 50 51 00:04:13,300 --> 00:04:14,320 more commands. 51 52 00:04:14,350 --> 00:04:17,730 One is the Except command and the other is the union command. 52 53 00:04:18,130 --> 00:04:20,890 So let us discuss the except command in the next video. 5405

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