Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,580 --> 00:00:06,390
It guys it's an exciting moment in the Adventure Works world because we are about to wire up our data
2
00:00:06,390 --> 00:00:09,630
model and create our table relationships.
3
00:00:09,630 --> 00:00:11,430
So in power be a desktop.
4
00:00:11,460 --> 00:00:13,920
There are two common ways to do this.
5
00:00:13,950 --> 00:00:20,190
Option number one which I prefer is to simply click and drag to connect your keys in the relationship
6
00:00:20,190 --> 00:00:21,060
view.
7
00:00:21,060 --> 00:00:27,510
So it's as simple as clicking on a foreign key dragging the mouse finding its primary key match and
8
00:00:27,510 --> 00:00:29,700
releasing to create that relationship.
9
00:00:29,790 --> 00:00:32,130
Very very simple very straightforward.
10
00:00:32,310 --> 00:00:36,000
Also a very visual way to create those relationships.
11
00:00:36,000 --> 00:00:43,390
The second option is to add or detect relationships using this manage relationships dialog box.
12
00:00:43,410 --> 00:00:44,600
So Same idea here.
13
00:00:44,610 --> 00:00:46,330
Just a little bit more manual.
14
00:00:46,440 --> 00:00:51,450
You would manually select the two tables that you'd like to relate as well as the primary and foreign
15
00:00:51,450 --> 00:00:52,760
key columns.
16
00:00:52,770 --> 00:00:59,210
So without further ado let's head into power be-I and add these relationships.
17
00:00:59,210 --> 00:00:59,780
All right.
18
00:00:59,780 --> 00:01:04,910
So here I am in the relationships view and I'm going to show you the slow way to create a relationship
19
00:01:04,910 --> 00:01:07,600
first and then we'll never do it that way again.
20
00:01:07,970 --> 00:01:12,310
And we use the manage relationships button in the home to.
21
00:01:12,540 --> 00:01:19,350
And as you can see I have a couple of options here you can choose auto detect and basically say I don't
22
00:01:19,350 --> 00:01:21,710
know what my relationships are going to look like.
23
00:01:21,750 --> 00:01:25,180
Why don't you analyze the tables and tell me whenever I've played with it.
24
00:01:25,180 --> 00:01:30,630
It usually gets some of the relationships right but Mrs. others so let's go ahead and disregard the
25
00:01:30,630 --> 00:01:37,220
auto detect option and we're going to add a new relationship manually and we're going to connect our
26
00:01:37,220 --> 00:01:41,090
sales table to our customer table.
27
00:01:41,530 --> 00:01:48,940
So A.W. sales to A.W. customer and without even clicking on a call on power be I automatically identified
28
00:01:49,270 --> 00:01:55,060
the foreign and primary key customer key column that matches these two tables together and it gives
29
00:01:55,060 --> 00:01:58,810
us a little bit of information about the cardinality and the cross filter.
30
00:01:58,810 --> 00:02:05,020
We're going to talk about both of those in-depth as well as this make relationship active option later
31
00:02:05,020 --> 00:02:05,950
on this section.
32
00:02:06,220 --> 00:02:07,980
But for now that's good enough.
33
00:02:08,050 --> 00:02:09,070
Press OK.
34
00:02:09,820 --> 00:02:12,730
And close and there you go.
35
00:02:12,760 --> 00:02:18,730
We've created our first table relationship between sales and customer look up and you'll see as you
36
00:02:18,730 --> 00:02:23,330
hover over this relationship line it kind of highlights what the key column is.
37
00:02:23,360 --> 00:02:26,250
You see that box around the customer key.
38
00:02:26,320 --> 00:02:28,810
So that's option number one the manual way.
39
00:02:28,990 --> 00:02:31,540
The easier way is to click and drag.
40
00:02:31,810 --> 00:02:38,630
So to connect calendar to SALES I'm just going to grab my order date and we'll talk about whether or
41
00:02:38,630 --> 00:02:41,270
not to use order versus stock in a little bit.
42
00:02:41,290 --> 00:02:47,960
But for now let's focus on order date and we're going to click and hold the mouse and just drag up and
43
00:02:47,960 --> 00:02:53,450
release it over the date field which is our primary key in the calendar look up and there you go we've
44
00:02:53,450 --> 00:02:55,970
created our second relationship.
45
00:02:56,200 --> 00:02:57,870
Same story with territories.
46
00:02:58,060 --> 00:03:06,170
Let's grab that territory foreign key drag it out to the sales territory key in the look out and now
47
00:03:06,170 --> 00:03:12,170
before we connect up the product look out I want to return back to my report view for just a second
48
00:03:12,710 --> 00:03:17,930
and remind you that we had been looking at order quantities and trying to break them down by product
49
00:03:17,930 --> 00:03:24,320
names to no avail because remember without the relationship these two tables are essentially islands
50
00:03:24,320 --> 00:03:25,890
that can't talk to each other.
51
00:03:25,980 --> 00:03:35,180
But now when we go back to relationships grab that product key drag it up to our product look at and
52
00:03:35,630 --> 00:03:37,560
it's going to be tricky.
53
00:03:37,560 --> 00:03:46,620
There is Product Key created the relationship and now drumroll please go back to report and look at
54
00:03:46,620 --> 00:03:52,680
that we've got correct values for quantities broken down by product name.
55
00:03:52,680 --> 00:03:58,530
And again this could be any field from product table all by simply dragging our mouse making a couple
56
00:03:58,530 --> 00:04:02,570
of clicks and creating that relationship between the two tables.
57
00:04:02,580 --> 00:04:06,210
So it's up back into our relationships view.
58
00:04:06,440 --> 00:04:08,650
And I'm just going to drag things around a little bit.
59
00:04:08,660 --> 00:04:14,050
You don't have to organize things exactly like I am really doesn't make any difference.
60
00:04:14,330 --> 00:04:17,560
Now I'm going to hold off on these two tables.
61
00:04:17,670 --> 00:04:23,330
We're going to talk about these in the next lecture and actually or rearrange kind of in a hierarchical
62
00:04:23,330 --> 00:04:26,990
way product subcategory category.
63
00:04:27,140 --> 00:04:28,850
But for now we're good to go.
64
00:04:28,880 --> 00:04:30,500
So congratulations.
65
00:04:30,500 --> 00:04:33,800
We've officially just built an Adventure Works data model.
6608
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.