All language subtitles for 01_joining-tables.en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
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:00,000 --> 00:00:03,690 A common task that we want to be able to accomplish is to join 2 00:00:03,690 --> 00:00:07,470 two datasets together based on the attributes and their tables. 3 00:00:07,470 --> 00:00:10,525 So, I'm going to show you how to do that. 4 00:00:10,525 --> 00:00:12,300 So, there's lots of reasons why you may want to 5 00:00:12,300 --> 00:00:15,595 join two datasets together based on their attributes. 6 00:00:15,595 --> 00:00:18,125 I'm going to show you a very common scenario 7 00:00:18,125 --> 00:00:19,970 it's not the only reason why you'd want to do this, 8 00:00:19,970 --> 00:00:24,930 but it's a common one which is that you want to take a non-GIS dataset, 9 00:00:24,930 --> 00:00:26,650 or a table that you found somewhere, 10 00:00:26,650 --> 00:00:28,140 and be able to map that data. 11 00:00:28,140 --> 00:00:31,820 So, you want to have or you have to connect that data that's not in 12 00:00:31,820 --> 00:00:33,800 a GIS format to a dataset that isn't 13 00:00:33,800 --> 00:00:37,330 a GIS format in order to be able to map that non-GIS data. 14 00:00:37,330 --> 00:00:38,660 So, this is my little scenario, 15 00:00:38,660 --> 00:00:40,100 it's a very common thing. 16 00:00:40,100 --> 00:00:43,070 It's like I said it's not the only reason to join tables together, 17 00:00:43,070 --> 00:00:46,980 but I think if I'll walk through this you'll see both how joining tables works, 18 00:00:46,980 --> 00:00:48,625 and why you may want to do this. 19 00:00:48,625 --> 00:00:52,550 So, my objective here is just as an example is I'm going 20 00:00:52,550 --> 00:00:57,235 to try to show the population density of each province in Canada. 21 00:00:57,235 --> 00:01:02,960 So, here's my provinces dataset that I have so this is a GIS dataset. 22 00:01:02,960 --> 00:01:05,599 When we look at the attribute data for this, 23 00:01:05,599 --> 00:01:07,850 you'll notice that there's nothing in there about population, 24 00:01:07,850 --> 00:01:09,440 there's nothing in there about area, 25 00:01:09,440 --> 00:01:11,585 there's nothing in there about population density. 26 00:01:11,585 --> 00:01:15,950 So I've got to start in that I have the areas that I 27 00:01:15,950 --> 00:01:20,645 want to make a map of in other words I've got the provinces and territories for Canada. 28 00:01:20,645 --> 00:01:24,160 But I don't have the data in there that I want to use to do my map. 29 00:01:24,160 --> 00:01:28,610 So, I have to find another dataset that does have that population data, 30 00:01:28,610 --> 00:01:32,780 and then I can attach that to this dataset using an attribute join. 31 00:01:32,780 --> 00:01:35,870 Just a little terminology you should be aware of is 32 00:01:35,870 --> 00:01:39,675 columns in a table in a database are called a field, 33 00:01:39,675 --> 00:01:42,750 and rows in a database are referred to as records. 34 00:01:42,750 --> 00:01:45,330 So, if you want to add a column to your table you're adding a field. 35 00:01:45,330 --> 00:01:48,920 If you want to add a row to your table you're adding a record. Just so you know. 36 00:01:48,920 --> 00:01:53,030 Okay, so here we have a second dataset that does 37 00:01:53,030 --> 00:01:57,160 have population values for each of the provinces and territories. 38 00:01:57,160 --> 00:02:00,230 The problem is is that it's not a GIS dataset, 39 00:02:00,230 --> 00:02:03,230 and I've put this in here just to help indicate that 40 00:02:03,230 --> 00:02:06,545 as you'll see that it has that little table icon. 41 00:02:06,545 --> 00:02:09,940 So that is being stored inside a Geo-database, 42 00:02:09,940 --> 00:02:12,100 you can see that there. 43 00:02:12,930 --> 00:02:16,315 So, there's the Geo-database icon. 44 00:02:16,315 --> 00:02:19,155 But it's not map-able, 45 00:02:19,155 --> 00:02:24,980 there's no GIS map coordinates attached to that dataset it's just a table. 46 00:02:24,980 --> 00:02:29,040 That table could just as easily have been in an Excel format or something else. 47 00:02:29,040 --> 00:02:33,740 So, we want to take that non map-able GIS data and somehow map it. 48 00:02:33,740 --> 00:02:38,105 We're going to do that by connecting it or joining it to our provinces data. 49 00:02:38,105 --> 00:02:41,835 So, here's our GIS file and our non-GIS file, 50 00:02:41,835 --> 00:02:44,900 and what we're going to do is connect these two things together. 51 00:02:44,900 --> 00:02:47,560 So, how can we link these tables together? 52 00:02:47,560 --> 00:02:50,930 I wonder if there's anything that they have in common that we 53 00:02:50,930 --> 00:02:54,580 could use to cross reference the information between them. 54 00:02:54,580 --> 00:02:56,075 There is, what do you now? 55 00:02:56,075 --> 00:02:57,415 Okay thank goodness! 56 00:02:57,415 --> 00:03:04,225 There's a code column or field that is the same in both datasets, 57 00:03:04,225 --> 00:03:08,240 and all that really means is as far as we're concerned here is that, 58 00:03:08,240 --> 00:03:11,120 we can get the software to go through these and say 59 00:03:11,120 --> 00:03:14,554 here's the NL code for for Newfoundland. 60 00:03:14,554 --> 00:03:18,465 In this table, where is the NL code here or there it is. 61 00:03:18,465 --> 00:03:22,670 So, it will line up or connect the data for 62 00:03:22,670 --> 00:03:28,700 those two entries so the this record here will be connected to this record here. 63 00:03:28,700 --> 00:03:31,565 So, I said Newfoundland it should be Newfoundland and Labrador, 64 00:03:31,565 --> 00:03:35,500 and so it will then go to the next one which is for Prince Edward Island. 65 00:03:35,500 --> 00:03:39,020 It will go and find that one in this dataset over 66 00:03:39,020 --> 00:03:42,710 here we will connect those two values together and so on. 67 00:03:42,710 --> 00:03:44,675 So, I do think of it this way in terms of 68 00:03:44,675 --> 00:03:47,720 cross-referencing are matching the data between the two, 69 00:03:47,720 --> 00:03:51,200 and then it will connect those two together and create a table that looks as 70 00:03:51,200 --> 00:03:55,420 though it's one big table or it can be treated as though it's one big table. 71 00:03:55,420 --> 00:03:58,880 So, the term that we use for this is we're going to join the tables together 72 00:03:58,880 --> 00:04:02,555 that's the term you'll see used in ArcMap. 73 00:04:02,555 --> 00:04:05,390 What I'm doing here is adjoined based on attributes, 74 00:04:05,390 --> 00:04:07,100 you can actually also do a join based on 75 00:04:07,100 --> 00:04:10,490 geography where instead of it being based on columns in a table, 76 00:04:10,490 --> 00:04:13,280 it's based on is this point inside a polygon, 77 00:04:13,280 --> 00:04:14,680 but we'll save that for another time. 78 00:04:14,680 --> 00:04:17,350 So, here we're just going to focus on attributes. 79 00:04:17,350 --> 00:04:20,840 So, the table that we're going to join the data to is called 80 00:04:20,840 --> 00:04:24,030 the target table so that's the target of our operation, 81 00:04:24,030 --> 00:04:28,490 and the table that we are joining to the target is known as the join table. 82 00:04:28,490 --> 00:04:30,620 I wonder how they came up with that name! 83 00:04:30,620 --> 00:04:33,140 Actually I'm not really fond of that 84 00:04:33,140 --> 00:04:35,680 in that it's you'd think they'd have would have called it something else. 85 00:04:35,680 --> 00:04:39,350 But okay, the join table is being joined to the target table. 86 00:04:39,350 --> 00:04:43,420 Sometimes that terminology comes up so I just wanted you to be aware of it. 87 00:04:43,420 --> 00:04:48,315 A couple more terms that you should be aware of is the primary key and the foreign key. 88 00:04:48,315 --> 00:04:53,790 This starts to get into concepts related to relational databases. 89 00:04:53,790 --> 00:04:55,535 I'll try to keep it simple here. 90 00:04:55,535 --> 00:04:58,760 Essentially, the idea with a primary key is that you have to have 91 00:04:58,760 --> 00:05:04,005 a unique way of identifying each of the records in our target table. 92 00:05:04,005 --> 00:05:06,620 In this case, each of those codes is different. 93 00:05:06,620 --> 00:05:09,680 We have a unique code for each province and territory. 94 00:05:09,680 --> 00:05:12,050 So, when we're trying to join data to 95 00:05:12,050 --> 00:05:15,695 that table the software can tell them apart from one another. 96 00:05:15,695 --> 00:05:17,345 If two of them have the same code, 97 00:05:17,345 --> 00:05:20,390 then it wouldn't know which thing to connect it to and so 98 00:05:20,390 --> 00:05:23,460 that would not be a useful way to try and identify them. 99 00:05:23,460 --> 00:05:26,270 There's lots of examples of this in the world if you 100 00:05:26,270 --> 00:05:29,690 have a student number or a social insurance number or things like 101 00:05:29,690 --> 00:05:32,810 that those are identifiers that are used to 102 00:05:32,810 --> 00:05:36,460 uniquely tell you apart from other people and it's exactly the same idea. 103 00:05:36,460 --> 00:05:37,850 If you had two people with the same number, 104 00:05:37,850 --> 00:05:39,090 you wouldn't be able to tell them apart, 105 00:05:39,090 --> 00:05:40,850 and then you wouldn't be able to join data from 106 00:05:40,850 --> 00:05:43,870 different data sets together and so the whole thing would break down. 107 00:05:43,870 --> 00:05:46,950 So, the essential component for us to remember for no, 108 00:05:46,950 --> 00:05:49,940 w with a primary key is that there has to be something that's 109 00:05:49,940 --> 00:05:53,905 unique that's able to tell those records apart from one another. 110 00:05:53,905 --> 00:05:57,950 The foreign key is the same column in 111 00:05:57,950 --> 00:06:02,360 our join table that's going to be used to join to the primary key. 112 00:06:02,360 --> 00:06:06,430 It's not a requirement with a foreign key that they all be unique to one another. 113 00:06:06,430 --> 00:06:09,770 There's various methods or ways of joining things together. 114 00:06:09,770 --> 00:06:13,340 You could actually have more than one entry or 115 00:06:13,340 --> 00:06:17,625 record in a join table that's joined to a target table. 116 00:06:17,625 --> 00:06:18,860 I'm not going to get into that right now, 117 00:06:18,860 --> 00:06:20,870 I just want to you to kind of get the general idea of this. 118 00:06:20,870 --> 00:06:23,750 But essentially, the idea is that the primary key has to be unique, 119 00:06:23,750 --> 00:06:25,550 the foreign key does not have to be unique, 120 00:06:25,550 --> 00:06:28,550 but there has to be something in that foreign key that matches 121 00:06:28,550 --> 00:06:30,440 up with what's in the primary key in order 122 00:06:30,440 --> 00:06:32,430 for it to be able to join those two things together. 123 00:06:32,430 --> 00:06:34,475 All right, so let's see how this all works. 124 00:06:34,475 --> 00:06:37,670 In order to accomplish a join we just right click 125 00:06:37,670 --> 00:06:41,570 on the target table in our table of contents. 126 00:06:41,570 --> 00:06:45,830 This will bring up a dialog box here that says join data, 127 00:06:45,830 --> 00:06:50,150 and we're going to join atributtes from a table 128 00:06:50,150 --> 00:06:53,060 and it says choose the field in this layer that the joint will be 129 00:06:53,060 --> 00:06:55,965 based on we're going to use the code column. 130 00:06:55,965 --> 00:06:58,940 By the way I try to keep things simple here by having 131 00:06:58,940 --> 00:07:00,830 the same name for the fields in 132 00:07:00,830 --> 00:07:03,740 both tables they're both called code that does not matter. 133 00:07:03,740 --> 00:07:07,280 I could have called them anything I want as long as I know that they are 134 00:07:07,280 --> 00:07:11,030 the correct ones and I know which one is the primary key and foreign key, that's okay. 135 00:07:11,030 --> 00:07:12,560 So, don't feel like they have to have 136 00:07:12,560 --> 00:07:15,020 the same name they don't as long as you know what it is. 137 00:07:15,020 --> 00:07:17,270 So, here I'm telling it that I'm going to use code, 138 00:07:17,270 --> 00:07:20,330 choose the table to join to this layer it's going to be called 139 00:07:20,330 --> 00:07:24,340 prov-pop so that's the population data for my provinces and territories. 140 00:07:24,340 --> 00:07:27,560 It just so happens that it's also the same name code 141 00:07:27,560 --> 00:07:30,620 here and I'm going to ask you to keep all the records okay. 142 00:07:30,620 --> 00:07:33,300 So, you just fill this in and I like the way that they set up this dialog box. 143 00:07:33,300 --> 00:07:35,120 It's just kind of a natural language way of 144 00:07:35,120 --> 00:07:37,350 saying what do you want to do and you're walks you through the steps, 145 00:07:37,350 --> 00:07:39,495 you fill it in, and then you're ready to go. 146 00:07:39,495 --> 00:07:42,170 So, here we have our joined tables. 147 00:07:42,170 --> 00:07:46,550 So, you'll notice that it actually looks like this is 148 00:07:46,550 --> 00:07:49,130 the provinces that attribute table because 149 00:07:49,130 --> 00:07:52,155 that's the target table that's what we were joining it to. 150 00:07:52,155 --> 00:07:53,650 But in actual fact, 151 00:07:53,650 --> 00:07:58,880 this is the province data provinces and territories data from that table, 152 00:07:58,880 --> 00:08:02,050 and this is the data from the prov-pop table. 153 00:08:02,050 --> 00:08:03,520 So, this was the non-GIS, 154 00:08:03,520 --> 00:08:07,240 non-map-able data that's now been joined to it. 155 00:08:07,240 --> 00:08:10,700 So the idea is that it's pretending or treating 156 00:08:10,700 --> 00:08:14,150 these two tables now as though they are all one big table. 157 00:08:14,150 --> 00:08:18,140 The whole point being that now the software has access to 158 00:08:18,140 --> 00:08:22,690 that non-GIS data and we can use it in our mapping operations. 159 00:08:22,690 --> 00:08:26,110 I've mentioned in here that the join is dynamic. 160 00:08:26,110 --> 00:08:27,945 That's an important point. 161 00:08:27,945 --> 00:08:33,435 So, what this means is that this has not created a new dataset, 162 00:08:33,435 --> 00:08:36,970 it hasn't changed anything in either of these tables in their files, 163 00:08:36,970 --> 00:08:39,130 nothing has been written to those files. 164 00:08:39,130 --> 00:08:43,005 All that's happening is that when I created this join, it says, 165 00:08:43,005 --> 00:08:45,120 "I've got one dataset here and another one there, 166 00:08:45,120 --> 00:08:47,050 he wants me to connect them this way, okay, 167 00:08:47,050 --> 00:08:49,645 I'm going to join those two together". Now they're joined. 168 00:08:49,645 --> 00:08:52,455 If I didn't save my map document, 169 00:08:52,455 --> 00:08:54,735 and I closed out of ArcMap. 170 00:08:54,735 --> 00:08:57,740 Then I came back later and open it again that joint would be gone. 171 00:08:57,740 --> 00:09:01,865 Because that's something that I asked it to do for me in real time. 172 00:09:01,865 --> 00:09:03,915 If I did save the map document, 173 00:09:03,915 --> 00:09:05,520 then it would be there the next time, 174 00:09:05,520 --> 00:09:08,750 because that join the fact that I'm 175 00:09:08,750 --> 00:09:12,725 asking to join those tables together is being stored in that map document. 176 00:09:12,725 --> 00:09:16,480 However, if I open those tables in a different map document, 177 00:09:16,480 --> 00:09:17,860 they would no longer be joined, 178 00:09:17,860 --> 00:09:19,115 that have to do that again. 179 00:09:19,115 --> 00:09:20,620 So, that's one thing to keep in mind. 180 00:09:20,620 --> 00:09:21,905 The other is that it's dynamic, 181 00:09:21,905 --> 00:09:26,050 meaning that when I open a map document and that join is being done, 182 00:09:26,050 --> 00:09:28,215 so I opened it up, the join has been stored, 183 00:09:28,215 --> 00:09:31,380 and the software says, "Oh he wants me to join this table that table". 184 00:09:31,380 --> 00:09:34,945 If anything has changed in that, one of those tables, 185 00:09:34,945 --> 00:09:39,450 that will automatically be reflected in the joined version of those tables. 186 00:09:39,450 --> 00:09:43,100 So, if there's a change to one of the tables, it's dynamically updated. 187 00:09:43,100 --> 00:09:48,265 It's not static. It's not creating a new set of values. 188 00:09:48,265 --> 00:09:51,010 It's saying, every time that join is done, 189 00:09:51,010 --> 00:09:55,300 it's looking for the fresh current version of that data, and that's what it's using. 190 00:09:55,300 --> 00:09:56,835 That's what I mean by dynamic. 191 00:09:56,835 --> 00:09:59,040 So, the join is stored in the map document. 192 00:09:59,040 --> 00:10:01,315 I said that already. I Just want to make sure that's clear. 193 00:10:01,315 --> 00:10:06,905 All of this is to say that now I can go into the Symbology tab in ArcMap, 194 00:10:06,905 --> 00:10:12,080 and I can access the population data from my non GIS table. 195 00:10:12,080 --> 00:10:13,465 Because now that I joined it, 196 00:10:13,465 --> 00:10:16,900 I can access it in the drop-down here, and I can use it. 197 00:10:16,900 --> 00:10:18,775 So, here's the attribute table here. 198 00:10:18,775 --> 00:10:20,630 So, this is the prof pop data, 199 00:10:20,630 --> 00:10:22,590 but it's now being joined to the other one. 200 00:10:22,590 --> 00:10:27,000 So, I can take those population values in here and that's what's being used 201 00:10:27,000 --> 00:10:31,990 here to create a choropleth map of those population values. 202 00:10:31,990 --> 00:10:36,045 So, this is the results. 203 00:10:36,045 --> 00:10:40,730 I've mapped my population data from a non-GIS dataset. 204 00:10:40,730 --> 00:10:44,620 All I had to do was do an attribute join so that I could access that. 205 00:10:44,620 --> 00:10:48,240 Now I've got a population map for Canada. 206 00:10:48,240 --> 00:10:52,210 This is really the fundamental idea behind a relational database. 207 00:10:52,210 --> 00:10:57,175 Essentially, the idea is just that you have two or more tables that are separate. 208 00:10:57,175 --> 00:10:59,630 They're stored separately, they're organized separately for 209 00:10:59,630 --> 00:11:02,705 whatever reason often it makes more sense to do that. 210 00:11:02,705 --> 00:11:07,550 For example, I was thinking if you are a university or college or whatever. 211 00:11:07,550 --> 00:11:09,220 If you have a student number, 212 00:11:09,220 --> 00:11:12,000 that's the primary key that's used to identify you, 213 00:11:12,000 --> 00:11:16,760 and there might be one table about what books you took out of the library. 214 00:11:16,760 --> 00:11:20,065 There might be another table about what courses you're taking. 215 00:11:20,065 --> 00:11:23,570 There might be another table about what fees you've paid. 216 00:11:23,570 --> 00:11:26,080 So, there might be different groups within 217 00:11:26,080 --> 00:11:29,575 the organization that are keeping track of those separately. 218 00:11:29,575 --> 00:11:33,010 But because they're all using the same primary key, 219 00:11:33,010 --> 00:11:37,080 your student number, they can relate those datasets together if they need to. 220 00:11:37,080 --> 00:11:38,910 So, they can say what do we know what this person? 221 00:11:38,910 --> 00:11:41,845 Or what's the current situation with this person? 222 00:11:41,845 --> 00:11:44,215 If they are able to access those datasets 223 00:11:44,215 --> 00:11:46,900 based on permissions and privacy of course and everything else. 224 00:11:46,900 --> 00:11:49,900 But the idea is with relational database is that you can have 225 00:11:49,900 --> 00:11:54,325 those separate tables and they can be connected to each other in various ways. 226 00:11:54,325 --> 00:11:56,400 It doesn't always have to be by one primary key. 227 00:11:56,400 --> 00:12:00,900 As long as any two tables within the larger set of tables, 228 00:12:00,900 --> 00:12:03,390 as long as any two of them have a primary key and a foreign key, 229 00:12:03,390 --> 00:12:04,800 those two can be joined together. 230 00:12:04,800 --> 00:12:06,360 So, it's a very flexible system. 231 00:12:06,360 --> 00:12:09,070 Relational database architecture is very old. 232 00:12:09,070 --> 00:12:10,550 It's been around for a long time. 233 00:12:10,550 --> 00:12:13,080 But the idea is that it's pretty straightforward. 234 00:12:13,080 --> 00:12:15,530 It's pretty simple to use in theory, 235 00:12:15,530 --> 00:12:18,270 and I think it's just popular because it works well. 236 00:12:18,270 --> 00:12:20,605 It's flexible and it's easy for people to understand. 237 00:12:20,605 --> 00:12:22,600 Now one thing about this map, 238 00:12:22,600 --> 00:12:26,330 by the way is my original objective was to map population densities. 239 00:12:26,330 --> 00:12:29,265 So, I'm going to show you how to do that in a separate video. 240 00:12:29,265 --> 00:12:32,105 But I didn't forget about that. I just want you to know. 241 00:12:32,105 --> 00:12:39,335 But one thing that I want to point out as well is that when you're joining tables, 242 00:12:39,335 --> 00:12:43,245 do not join them based on the object ID column. 243 00:12:43,245 --> 00:12:45,710 This is a common mistake that newbies make. 244 00:12:45,710 --> 00:12:47,725 I just want to make sure this is clear is that 245 00:12:47,725 --> 00:12:50,035 I said you have to have a primary key and a foreign key. 246 00:12:50,035 --> 00:12:52,220 If you're trying to join two datasets together, 247 00:12:52,220 --> 00:12:53,765 especially if they don't have 248 00:12:53,765 --> 00:12:56,665 a primary key and foreign key that are common to one another, 249 00:12:56,665 --> 00:12:58,625 it's really tempting to say look, 250 00:12:58,625 --> 00:13:00,480 there's these object ID columns. 251 00:13:00,480 --> 00:13:04,045 They both have values from one to 13. I'll just use those. 252 00:13:04,045 --> 00:13:07,370 Don't. The reason for that is that, 253 00:13:07,370 --> 00:13:09,380 and I'm not even sure why Ezri shows you 254 00:13:09,380 --> 00:13:12,985 these columns because there really of no use to you as a user, 255 00:13:12,985 --> 00:13:15,850 unless under some really unusual circumstances. 256 00:13:15,850 --> 00:13:21,870 But essentially, that's used to keep track of the features that are being mapped, 257 00:13:21,870 --> 00:13:23,090 and the coordinates that are being used, 258 00:13:23,090 --> 00:13:27,010 and things like that behind the scenes that the software is using. 259 00:13:27,010 --> 00:13:29,135 These are not useful to you. 260 00:13:29,135 --> 00:13:31,470 So, the numbers that are being assigned as 261 00:13:31,470 --> 00:13:35,485 object IDs are assigned in the order in which those objects are created. 262 00:13:35,485 --> 00:13:37,785 Okay? So, for example, 263 00:13:37,785 --> 00:13:39,840 Alberta was created first. 264 00:13:39,840 --> 00:13:42,405 So, it has an object ID of one. 265 00:13:42,405 --> 00:13:44,710 British Columbia was second, so, 266 00:13:44,710 --> 00:13:47,085 it has an object ID of two, and so on. 267 00:13:47,085 --> 00:13:50,815 Right? That's in the provinces' table. 268 00:13:50,815 --> 00:13:52,585 In the prof pop table, 269 00:13:52,585 --> 00:13:57,830 the first entry or record that was created was for Newfoundland and Labrador. 270 00:13:57,830 --> 00:14:00,350 So, it gets an object ID of one. 271 00:14:00,350 --> 00:14:03,030 The second one that was created was for Prince Edward Island. 272 00:14:03,030 --> 00:14:04,525 So, it gets a value of two. 273 00:14:04,525 --> 00:14:08,775 So, in other words, if you tried to join these together, 274 00:14:08,775 --> 00:14:12,990 so without me drawing all over, this is what it's showing here, 275 00:14:12,990 --> 00:14:17,070 what we should be doing is that this should 276 00:14:17,070 --> 00:14:21,930 be object one if this was actually going to work but they don't. 277 00:14:21,930 --> 00:14:23,910 So, they're not going to line up correctly. 278 00:14:23,910 --> 00:14:26,190 What will actually end up happening if you try to join them based 279 00:14:26,190 --> 00:14:28,470 on this is that the data for Alberta will 280 00:14:28,470 --> 00:14:31,660 be joined with the data for Newfoundland and Labrador 281 00:14:31,660 --> 00:14:35,015 because they both have the same object ID of one, 282 00:14:35,015 --> 00:14:36,700 which of course would be incorrect. 283 00:14:36,700 --> 00:14:38,985 So, just pay attention to that. 284 00:14:38,985 --> 00:14:40,940 You may at first glance, 285 00:14:40,940 --> 00:14:44,310 looks at the object IDs and see if they look like they're lining up correctly. 286 00:14:44,310 --> 00:14:47,530 If they do, it's just purely by chance, it's a fluke. 287 00:14:47,530 --> 00:14:49,610 You never know especially if it's a big dataset, 288 00:14:49,610 --> 00:14:52,115 somewhere down the line, maybe they don't line up correctly. 289 00:14:52,115 --> 00:14:54,595 So, it's not something I would ever rely on. 290 00:14:54,595 --> 00:14:58,290 So, this is a long explanation for just saying that it's tempting 291 00:14:58,290 --> 00:15:02,620 to want to use object IDs for joining tables but it's a really bad idea.25623

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