File notes/fig/rel_mod/PERSON.tex added (mode: 100644) (index 0000000..1528191) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
% PERSON(SSN (PK), DOB, ADDRESS (FK to PLACE.Address) |
|
5 |
|
% ADDRESS(Address (PK), Rooms) |
|
6 |
|
|
|
7 |
|
\Frame(0,0){1}[NAME]{ |
|
8 |
|
SSN/PK, |
|
9 |
|
DOB/A, |
|
10 |
|
StaysAt/A}; |
|
11 |
|
|
|
12 |
|
\Frame(5, 0){2}[ADDRESS]{ |
|
13 |
|
Address/PK, |
|
14 |
|
Rooms/A}; |
|
15 |
|
|
|
16 |
|
\draw[FK] % From Habitants2 to Id1 |
|
17 |
|
(Address2)++(0,0) -- ++(0,-.5) -- ++(-0,0) coordinate (inter) |
|
18 |
|
-- (StaysAt1 |- inter) --++(0,0.6); |
|
19 |
|
\end{tikzpicture} |
|
20 |
|
\end{document} |
File notes/lectures_notes.md changed (mode: 100644) (index 55fe01b..f6f8360) |
... |
... |
Exercise +.# |
4428 |
4428 |
|
|
4429 |
4429 |
Exercise +.# |
Exercise +.# |
4430 |
4430 |
|
|
4431 |
|
: Draw an ER diagram with a single entity type, with two stored attributes and one derived attribute. In your answer, it should be clear that the value for the derived attribute will always be obtained from the value(s) for the other attribute(s). |
|
|
4431 |
|
: Draw an ER diagram with a single entity type, with two stored attributes and one derived attribute. In your answer, it should be clear that the value for the derived attribute can always be obtained from the value(s) for the other attribute(s). |
4432 |
4432 |
|
|
4433 |
4433 |
Exercise +.# |
Exercise +.# |
4434 |
4434 |
|
|
4435 |
4435 |
: Draw an ER diagram expressing the total participation of an entity type "BURGER" in a binary relation "CONTAINS" between "BURGER" and "INGREDIENT". |
: Draw an ER diagram expressing the total participation of an entity type "BURGER" in a binary relation "CONTAINS" between "BURGER" and "INGREDIENT". |
4436 |
4436 |
What would be the ratio of such a relation? |
What would be the ratio of such a relation? |
4437 |
4437 |
|
|
4438 |
|
Exercise +.# |
|
4439 |
|
~ |
|
4440 |
|
Convert the following ER diagram into a relational model: |
|
4441 |
|
|
|
4442 |
|
![](fig/er/Stays_At) |
|
4443 |
|
|
|
4444 |
4438 |
Exercise +.# |
Exercise +.# |
4445 |
4439 |
|
|
4446 |
4440 |
: What is the difference between an entity type and a weak entity type? |
: What is the difference between an entity type and a weak entity type? |
|
... |
... |
Exercise +.# |
4453 |
4447 |
|
|
4454 |
4448 |
: Why do weak entity type have a total participation constraint? |
: Why do weak entity type have a total participation constraint? |
4455 |
4449 |
|
|
|
4450 |
|
Exercise +.# |
|
4451 |
|
~ |
|
4452 |
|
Convert the following ER diagram into a relational model: |
|
4453 |
|
|
|
4454 |
|
![](fig/er/Stays_At) |
|
4455 |
|
|
4456 |
4456 |
Exercise +.# |
Exercise +.# |
4457 |
4457 |
|
|
4458 |
4458 |
: What is insertion anomaly? Give an example. |
: What is insertion anomaly? Give an example. |
|
... |
... |
Solution +.# |
4695 |
4695 |
|
|
4696 |
4696 |
Solution +.# |
Solution +.# |
4697 |
4697 |
|
|
4698 |
|
: ![](fig/er/Person) |
|
4699 |
|
|
|
|
4698 |
|
: ![](fig/er/Example_of_Derived) |
4700 |
4699 |
|
|
4701 |
4700 |
Solution +.# |
Solution +.# |
4702 |
4701 |
|
|
|
... |
... |
Solution +.# |
4704 |
4703 |
|
|
4705 |
4704 |
Solution +.# |
Solution +.# |
4706 |
4705 |
|
|
4707 |
|
: To be written. |
|
4708 |
|
|
|
4709 |
|
Solution +.# |
|
4710 |
|
|
|
4711 |
4706 |
: The weak entity type doesn't have a key attribute, it cannot be distinguised from the other weak entities based on a single attribute, for that we also need to know its relationship to some other entity type. |
: The weak entity type doesn't have a key attribute, it cannot be distinguised from the other weak entities based on a single attribute, for that we also need to know its relationship to some other entity type. |
4712 |
4707 |
|
|
4713 |
4708 |
Solution +.# |
Solution +.# |
|
... |
... |
Solution +.# |
4720 |
4715 |
|
|
4721 |
4716 |
Solution +.# |
Solution +.# |
4722 |
4717 |
|
|
|
4718 |
|
~ |
|
4719 |
|
|
|
4720 |
|
A possible option is: |
|
4721 |
|
|
|
4722 |
|
![ |
|
4723 |
|
PERSON(SSN (PK), DOB, Stays_At (FK to PLACE.Address) |
|
4724 |
|
ADDRESS(Address (PK), Rooms) |
|
4725 |
|
](fig/rel_mod/PERSON) |
|
4726 |
|
\ |
|
4727 |
|
|
|
4728 |
|
Note that "Stays_At" could also be a separate relation, with two attributes, "Address" and "Person", linked to respectively PLACE.Address and PERSON.SSN, and both being the primary key of the relation. |
|
4729 |
|
|
|
4730 |
|
Solution +.# |
|
4731 |
|
|
4723 |
4732 |
: When you have to invent a primary key or add a lot of `NULL` value to be able to add a tuple. I want to add a room in my DB, but the only place where rooms are listed are as an attribute on a Instructor table, so I have to "fake" an instructor to add a room. |
: When you have to invent a primary key or add a lot of `NULL` value to be able to add a tuple. I want to add a room in my DB, but the only place where rooms are listed are as an attribute on a Instructor table, so I have to "fake" an instructor to add a room. |
4724 |
4733 |
|
|
4725 |
4734 |
Solution +.# |
Solution +.# |
4726 |
4735 |
|
|
4727 |
4736 |
: A delete anomaly exists when certain attributes are lost because of the deletion of other attributes. It is not desirable, since it can lead to the loss of information. |
: A delete anomaly exists when certain attributes are lost because of the deletion of other attributes. It is not desirable, since it can lead to the loss of information. |
4728 |
4737 |
|
|
|
4738 |
|
|
4729 |
4739 |
Solution +.# |
Solution +.# |
4730 |
4740 |
|
|
4731 |
4741 |
: Because they waste space, and because they are ambiguous (N/A, or unknown, or not communicated?). No, it is necessary sometimes. |
: Because they waste space, and because they are ambiguous (N/A, or unknown, or not communicated?). No, it is necessary sometimes. |
|
... |
... |
Solution to [%D %n (%T)](#problem:consultation) |
5275 |
5285 |
|
|
5276 |
5286 |
We could further infer that the treatment for a given diagnosis is functionally dependant, but we should be sure to allow the doctor to have some flexibility when prescribing cures. |
We could further infer that the treatment for a given diagnosis is functionally dependant, but we should be sure to allow the doctor to have some flexibility when prescribing cures. |
5277 |
5287 |
|
|
|
5288 |
|
--- |
5278 |
5289 |
|
|
5279 |
5290 |
Solution to [%D %n (%T)](#problem:book) |
Solution to [%D %n (%T)](#problem:book) |
5280 |
5291 |
~ |
~ |