File notes/fig/rel_mod/BIKE_FK.tex added (mode: 100644) (index 0000000..37d3df5) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
|
|
5 |
|
% ACTOR(Id (PK), Name, Birthdate) |
|
6 |
|
% MOVIE(Title (PK), Year, Length, Studio) |
|
7 |
|
% THEATER(Name (PK), Street, City, State, Zip) |
|
8 |
|
% ACTING(ActorId (PK, FK to ACTOR.Id), MovieTitle (PK, FK to MOVIE.Title)) |
|
9 |
|
% SHOWING(TheaterName (PK, FK to THEATER.Name), MovieTitle(PK, FK to MOVIE.Title), Day (PK), Time (PK)) |
|
10 |
|
|
|
11 |
|
\Frame(0,0){1}[CUSTOMER]{ |
|
12 |
|
Name/PK, |
|
13 |
|
Phone/A, |
|
14 |
|
AssignedEmployee/A, |
|
15 |
|
LevelOfSatisfaction/A}; |
|
16 |
|
|
|
17 |
|
\Frame(0,-2.5){2}[BIKE]{ |
|
18 |
|
DroppedTimeDate/PK, |
|
19 |
|
Customer/PK, |
|
20 |
|
Color/A, |
|
21 |
|
Brand/A, |
|
22 |
|
RepairedBy/A}; |
|
23 |
|
|
|
24 |
|
\Frame(10,0){3}[EMPLOYEE]{ |
|
25 |
|
Name/PK}; |
|
26 |
|
|
|
27 |
|
\Frame(10,-2.5){4}[SPECIALTY]{ |
|
28 |
|
Employee/PK, |
|
29 |
|
Specialty/PK}; |
|
30 |
|
|
|
31 |
|
\draw[FK] % From CUSTOMER.AssignedEmployee to EMPLOYEE.Name |
|
32 |
|
(Name3)++(-0.2,0) -- ++(0,-.55) coordinate (inter) |
|
33 |
|
-- (AssignedEmployee1 |- inter) --++(0, 0.5); |
|
34 |
|
|
|
35 |
|
\draw[FK] % From BIKE.Customer to CUSTOMER.Name |
|
36 |
|
(Name1)++(0.1,0) -- ++(0,-0.5) --++(-1.5, 0) |
|
37 |
|
--++(0, -3) |
|
38 |
|
coordinate (inter) |
|
39 |
|
-- (Customer2 |- inter) --++(0, 1); |
|
40 |
|
|
|
41 |
|
\draw[FK] % From BIKE.RepairedBy to EMPLOYEE.Name |
|
42 |
|
(Name3)++(0,0) -- ++(0,-.75)--++(-1, 0) --++(0, -3) |
|
43 |
|
coordinate (inter) |
|
44 |
|
-- (RepairedBy2 |- inter) --++(0, 1.3); |
|
45 |
|
|
|
46 |
|
\draw[FK] % From SPECIALTY.Employee to EMPLOYEE.Name |
|
47 |
|
(Name3)++(0.2,0) -- ++(0,-.85)--++(-1, 0) --++(0, -2.9) |
|
48 |
|
coordinate (inter) |
|
49 |
|
-- (Employee4 |- inter) --++(0, 1.25); |
|
50 |
|
\end{tikzpicture} |
|
51 |
|
\end{document} |
File notes/lectures_notes.md changed (mode: 100644) (index 407b5b0..40a6f2e) |
... |
... |
Solution to [%D %n (%T)](#problem:roleplaying) |
3499 |
3499 |
](fig/rel_mod/RPG) |
](fig/rel_mod/RPG) |
3500 |
3500 |
\ |
\ |
3501 |
3501 |
|
|
|
3502 |
|
--- |
|
3503 |
|
|
3502 |
3504 |
Solution to [%D %n (%T)](#problem:sqlBooks) |
Solution to [%D %n (%T)](#problem:sqlBooks) |
3503 |
3505 |
~ |
~ |
3504 |
3506 |
|
|
|
... |
... |
Solution to [%D %n (%T)](#problem:car-insurance) |
5303 |
5305 |
|
|
5304 |
5306 |
--- |
--- |
5305 |
5307 |
|
|
|
5308 |
|
|
|
5309 |
|
|
|
5310 |
|
Solution to [%D %n (%T)](#problem:ERtoRELBike) |
|
5311 |
|
~ |
|
5312 |
|
"Is it true that …" |
|
5313 |
|
|
|
5314 |
|
|
|
5315 |
|
<!-- bug with table --> |
|
5316 |
|
| Yes | No | |
|
5317 |
|
------------ | --- | --- | |
|
5318 |
|
"… a customer cannot drop two bikes at the exact same time and date? | ✔ | | |
|
5319 |
|
"… two different customers cannot drop two different bikes at the exact same time and date? | | ✔ | |
|
5320 |
|
"… an employee cannot repair two bikes at the same time? | | ✔ | |
|
5321 |
|
"… a customer can be assigned to more than one employee? | | ✔ | |
|
5322 |
|
"… a customer can have a bike repaired by an employee that is not assigned to them? | ✔ | | |
|
5323 |
|
"… a bike can be in the database without having been dropped by a customer? | | ✔ | |
|
5324 |
|
"… an employee can be asked to repair a bike without having that type of bike as one of their specialty? | ✔ | | |
|
5325 |
|
|
|
5326 |
|
For the $1:M$ relationships that are not identifying, we can chose between the foreign key and the cross-reference approaches. |
|
5327 |
|
If we use the former, we obtain: |
|
5328 |
|
|
|
5329 |
|
![](fig/rel_mod/BIKE_FK) |
|
5330 |
|
|
|
5331 |
|
We could also have used a combination of both! |
|
5332 |
|
|
|
5333 |
|
--- |
|
5334 |
|
|
5306 |
5335 |
Solution to [%D %n (%T)](#problem:carsale) |
Solution to [%D %n (%T)](#problem:carsale) |
5307 |
5336 |
~ |
~ |
5308 |
5337 |
|
|
|
... |
... |
Solution to [%D %n (%T)](#problem:book) |
5364 |
5393 |
- Because of \{Book title\} → \{ Book\_type\} → \{ List\_price\}\\ |
- Because of \{Book title\} → \{ Book\_type\} → \{ List\_price\}\\ |
5365 |
5394 |
(Book Title, Publisher, Book Type) and (Book Type, List Price), (Author Name, Author Affiliation), (Author Name, Book Title). |
(Book Title, Publisher, Book Type) and (Book Type, List Price), (Author Name, Author Affiliation), (Author Name, Book Title). |
5366 |
5395 |
|
|
|
5396 |
|
--- |
|
5397 |
|
|
5367 |
5398 |
Solution to [%D %n (%T)](#problem:carinfo) |
Solution to [%D %n (%T)](#problem:carinfo) |
5368 |
5399 |
~ |
~ |
5369 |
5400 |
|
|