File notes/lectures_notes.md changed (mode: 100644) (index 28dac44..10f66bc) |
... |
... |
The three last sublanguages being dubbed "**D**ata **M**anipulation **L**anguage |
1069 |
1069 |
| "Common" / Relational | SQL | |
| "Common" / Relational | SQL | |
1070 |
1070 |
| :--: | :--: | |
| :--: | :--: | |
1071 |
1071 |
| "Database" | Schema | |
| "Database" | Schema | |
1072 |
|
| "Set of databases" | Catalog (collection of named schema) | |
|
|
1072 |
|
| "Set of databases" | Catalog (named collection of schema)^[For a clarification on the distinction between catalog and schemas, you can refer to e.g. <https://stackoverflow.com/q/7022755>.] | |
1073 |
1073 |
| Relation | Table | |
| Relation | Table | |
1074 |
1074 |
| Tuple | Row | |
| Tuple | Row | |
1075 |
1075 |
| Attribute | Column, or Field | |
| Attribute | Column, or Field | |
|
... |
... |
SELECT * FROM DEPARTMENT WHERE Head IS NOT NULL; |
1681 |
1681 |
SELECT COUNT(*) FROM GRADE WHERE Grade IS NULL; |
SELECT COUNT(*) FROM GRADE WHERE Grade IS NULL; |
1682 |
1682 |
~~~ |
~~~ |
1683 |
1683 |
|
|
|
1684 |
|
There are no `if…then…else` statements in `SQL`, but you can do something similar with `CASE` (cf. <https://dev.mysql.com/doc/refman/8.0/en/case.html>). |
|
1685 |
|
However, note that `SQL` is probably _not_ the right place to try to control the flow of execution. |
|
1686 |
|
|
|
1687 |
|
Even with three times (!) the verbose option, MySQL does not give more insight as to whenever it drops comparing values once a NULL was encountered (cf. <https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_verbose>, you can log-in using `mysql -u testuser -p --password=password -v -v -v` to activate the most verbose mode). |
|
1688 |
|
Normally, `EXPLAIN` (<https://dev.mysql.com/doc/refman/8.0/en/explain.html>) should be useful in determining whenever MySQL uses some form of short-cut evaluation when comparing with `NULL`{.sqlmysql}, but I could not make it work. |
|
1689 |
|
|
1684 |
1690 |
## Various Tools |
## Various Tools |
1685 |
1691 |
|
|
1686 |
1692 |
For `DISTINCT`, `ALL` and `UNION`, cf. [@Textbook6, 4.3.4] or [@Textbook7, 6.3.4]. |
For `DISTINCT`, `ALL` and `UNION`, cf. [@Textbook6, 4.3.4] or [@Textbook7, 6.3.4]. |
1687 |
1693 |
For `ORDER BY` , cf. [@Textbook6, 4.3.6] or [@Textbook7, 6.3.6]. |
For `ORDER BY` , cf. [@Textbook6, 4.3.6] or [@Textbook7, 6.3.6]. |
1688 |
1694 |
For aggregate functions, cf. [@Textbook6, 5.1.7] or [@Textbook7, 7.1.7]. |
For aggregate functions, cf. [@Textbook6, 5.1.7] or [@Textbook7, 7.1.7]. |
1689 |
1695 |
|
|
|
1696 |
|
## AUTO_INCREMENT |
|
1697 |
|
|
|
1698 |
|
Something that is not exactly a constraint, but that can be used to "qualify" domains, is the `AUTO_INCREMENT`{.sqlmysql} feature of MySQL. |
|
1699 |
|
Cf. <https://dev.mysql.com/doc/refman/8.0/en/example-auto-increment.html>, you can have MySQL increment a particular attribute (most probably intended to be your primary key) for you. |
|
1700 |
|
|
1690 |
1701 |
|
|
1691 |
1702 |
### Transactions |
### Transactions |
1692 |
1703 |
|
|
|
... |
... |
We indicate the ratio on the edges: |
3820 |
3831 |
|
|
3821 |
3832 |
 |
 |
3822 |
3833 |
|
|
|
3834 |
|
Note that reflexive relations can have any ratio as well. |
|
3835 |
|
An example of $M:N$ recursive relation could be: |
|
3836 |
|
|
|
3837 |
|
 |
|
3838 |
|
|
3823 |
3839 |
##### Participation constraint |
##### Participation constraint |
3824 |
3840 |
|
|
3825 |
3841 |
**Minimum** number of relationships instances that an entity can participat it, a.k.a. "minimum cardinality constraint". |
**Minimum** number of relationships instances that an entity can participat it, a.k.a. "minimum cardinality constraint". |
|
... |
... |
As an exercise, you can look at the relationships TEACHING, MENTORING and EMITED |
3859 |
3875 |
|
|
3860 |
3876 |
#### Relationships of degree higher than two |
#### Relationships of degree higher than two |
3861 |
3877 |
|
|
3862 |
|
To determine cardinality ratio: fix all but one, wonder how many can be in that relationship. |
|
3863 |
|
|
|
|
3878 |
|
Of course, relationships can have a degree higher than two. |
3864 |
3879 |
An example of a ternary relation could be: |
An example of a ternary relation could be: |
3865 |
3880 |
|
|
3866 |
3881 |
 |
 |
3867 |
3882 |
|
|
3868 |
|
The idea is that Customer Y and Bank Z could be in relationship with more than $1$ account (hence the "N"). |
|
|
3883 |
|
To determine cardinality ratio, one should fix all but one parameters, and wonder how many values of the remaining parameter can be in that relationship. |
|
3884 |
|
|
|
3885 |
|
Four our example, Customer Y and Bank Z could be in relationship with more than $1$ account (hence the "N"). |
3869 |
3886 |
On the oppsite, Customer Y and Account K would be in relationship with only $1$ bank (hence the "1" on the bottom), and Bank Z and Account K would belong to only $1$ customer (hence the $1$ on the left). |
On the oppsite, Customer Y and Account K would be in relationship with only $1$ bank (hence the "1" on the bottom), and Bank Z and Account K would belong to only $1$ customer (hence the $1$ on the left). |
3870 |
3887 |
|
|
|
3888 |
|
It is sometimes impossible to do without relations with arity greater than $2$. |
|
3889 |
|
For instance, consider the following two diagrams: |
|
3890 |
|
|
|
3891 |
|
 |
|
3892 |
|
|
|
3893 |
|
 |
|
3894 |
|
|
|
3895 |
|
You should realize that they convey different information. |
|
3896 |
|
For instance, you can know for a fact that a person visit a library only if they bought something in it, while the second diagram de-correlate the act of buying with the visit to a library. |
|
3897 |
|
Similarly, the second diagram could give you a hint that a person that owns a copy of a book Z and visits a library X that sells it could also visit it, but you won't know that for sure. |
|
3898 |
|
|
3871 |
3899 |
An example of recursive ternary relation could be: |
An example of recursive ternary relation could be: |
3872 |
3900 |
|
|
3873 |
3901 |
 |
 |
|
... |
... |
Whenever the pet entity type is involved in other relationships or not should he |
3921 |
3949 |
- Owner can itself be weak! |
- Owner can itself be weak! |
3922 |
3950 |
- The degree of the identifying relationship can be more than 2 (cf. e.g., <https://stackoverflow.com/q/15393587/>). |
- The degree of the identifying relationship can be more than 2 (cf. e.g., <https://stackoverflow.com/q/15393587/>). |
3923 |
3951 |
|
|
|
3952 |
|
Another example of weak entity whose owner is weak as well could be: |
|
3953 |
|
|
|
3954 |
|
 |
|
3955 |
|
|
|
3956 |
|
The idea being that the Health care provider cares about an insuree only if they are covered by them, and that they care about the doula only if they are currently helping one of their insuree. |
|
3957 |
|
|
3924 |
3958 |
### Alternative Notations {#sec:alternative-notation} |
### Alternative Notations {#sec:alternative-notation} |
3925 |
3959 |
|
|
3926 |
3960 |
Multiple notations have been used to represent the ratio and constraint on relationship. |
Multiple notations have been used to represent the ratio and constraint on relationship. |
|
... |
... |
Using four tools: Relations, Attributes, Primary Keys, Foreign Keys. |
4005 |
4039 |
|
|
4006 |
4040 |
### Algorithm |
### Algorithm |
4007 |
4041 |
|
|
|
4042 |
|
We will use three techniques to represent some of the relationships, the foreign key approach, the merged relations approach and the cross-reference approach. |
|
4043 |
|
They are detailled and illustrated after the algorithm, which goes as follows: |
|
4044 |
|
|
4008 |
4045 |
\# | | is mapped to | |
\# | | is mapped to | |
4009 |
4046 |
-- | ---------- | ---------------- |
-- | ---------- | ---------------- |
4010 |
|
1 | Strong Entity | Relation with all the simple attributes. Decompose complex attributes. Pick a key to be the PK, if it is composite, take its elements. |
|
4011 |
|
2 | Weak Entity | Relation with all the simple attributes. Decompose complex attributes. Add as a foreign key the primary key of the relation corresponding to the owner entity type, and make it a primary key. If the owner entity type is itself weak, start with it. |
|
|
4047 |
|
1 | Strong Entity | Relation with all the simple attributes. Decompose complex (composite) attributes. Pick a key to be the PK, if it is composite, take its elements. |
|
4048 |
|
2 | Weak Entity | Relation with all the simple attributes. Decompose complex attributes. Add as a foreign key the primary key of the relation corresponding to the owner entity type, and make it a primary key, in addition to the partial key of the weak entity. If the owner entity type is itself weak, start with it. |
4012 |
4049 |
3 | Binary $1:1$ Relationship Types | Foreign Key, Merge Relations or Cross-Reference approach |
3 | Binary $1:1$ Relationship Types | Foreign Key, Merge Relations or Cross-Reference approach |
4013 |
4050 |
4 | Binary $1:N$ Relationship Types | Foreign Key or Cross-Reference approach |
4 | Binary $1:N$ Relationship Types | Foreign Key or Cross-Reference approach |
4014 |
4051 |
5 | Binary $M:N$ Relationship Types | Cross-Reference approach |
5 | Binary $M:N$ Relationship Types | Cross-Reference approach |
4015 |
4052 |
6 | $n$-ary Relationship Types | Cross-Reference approach |
6 | $n$-ary Relationship Types | Cross-Reference approach |
4016 |
|
7 | Multivalued Attributes | Create a new relation, whose primary key is the foreign key to the entity. |
|
|
4053 |
|
7 | Multivalued Attributes | Create a new relation, whose primary key is the foreign key to the relation corresponding to the entity. |
4017 |
4054 |
|
|
4018 |
4055 |
#. Foreign Key Approach: Chose one of the relation (preferably with total participation constraint, or on the N side), add a foreign key and all the attributes of the relationship. |
#. Foreign Key Approach: Chose one of the relation (preferably with total participation constraint, or on the N side), add a foreign key and all the attributes of the relationship. |
4019 |
4056 |
#. Merged Relation Approach: If both participations are total, just merge them. Primary key = just pick one, and add a `NOT NULL` constraint on the other. |
#. Merged Relation Approach: If both participations are total, just merge them. Primary key = just pick one, and add a `NOT NULL` constraint on the other. |
4020 |
|
#. Cross-Reference or Relationship Relation Approach: Create a lookup table with two (or more!) foreign keys, pick one of them (or the one on the N side, or both if $M:N$, or all if $n$-ary) as the primary key. |
|
|
4057 |
|
#. Cross-Reference or Relationship Relation Approach: Create a lookup table with an appropriate number of foreign keys, pick some of them (the one on the $N$ side, both if the ratio is $M:N$, for $n$-ary it is a bit more complex, cf. example below) as the primary key. |
|
4058 |
|
|
|
4059 |
|
Every time a relationships have attributes, they are mapped to the resultiong relation. |
|
4060 |
|
|
|
4061 |
|
Let us look in more details at some of those steps. |
|
4062 |
|
For strong entities, using steps 1 and 7, the following: |
|
4063 |
|
|
|
4064 |
|
 |
|
4065 |
|
|
|
4066 |
|
would give: |
|
4067 |
|
|
|
4068 |
|
 |
|
4072 |
|
\ |
|
4073 |
|
|
|
4074 |
|
|
|
4075 |
|
And note that if Serial was a complex attribute, we would just "unfold" it, or decompose it, and make all the resulting attributes the primary key of the relation. |
|
4076 |
|
If one of the attribute was at the same time multi-valued and composite, as follows: |
|
4077 |
|
|
|
4078 |
|
 |
4021 |
4079 |
|
|
4022 |
|
**Bug: + Propagate option? Cascade, most of the time: weak entity type, lookup tables, etc.** |
|
|
4080 |
|
Then we would obtain: |
4023 |
4081 |
|
|
4024 |
|
{width=90%} |
|
|
4082 |
|
 |
|
4086 |
|
\ |
|
4087 |
|
|
|
4088 |
|
For relationships, things are a bit more complicated. |
|
4089 |
|
Consider the following: |
|
4090 |
|
|
|
4091 |
|
 |
|
4092 |
|
|
|
4093 |
|
Since it is a $1:1$ relationship where one of the side has a partial constraint, we have the choice between two approaches. |
|
4094 |
|
The foreign key approach would give: |
|
4095 |
|
|
|
4096 |
|
 |
|
4100 |
|
\ |
|
4101 |
|
|
|
4102 |
|
Note that we could also have added the foreign key on the side of ENT.B, referencing the key of ENT.A. |
|
4103 |
|
But since ENT.A has a total participation constraint, we know that the value of FK will always exist, whereas some entities in ENT.B may not be in relationship with an entity from ENT.A, creating the (nefast) need for `NULL`{.sqlmysql} values. |
|
4104 |
|
|
|
4105 |
|
For the same diagram, the cross-reference approach would give: |
|
4106 |
|
|
|
4107 |
|
 |
|
4112 |
|
\ |
|
4113 |
|
|
|
4114 |
|
Similarly, note that, in MAPPING, KeyB, or KeyA and KeyB, would also be valid primary keys, but that it makes more sense to have KeyA being the primary key, since we know that ENT.A has a total participation constraint, but ENT.B does not. |
|
4115 |
|
|
|
4116 |
|
If both participation constraints were total, as follows: |
|
4117 |
|
|
|
4118 |
|
 |
|
4119 |
|
|
|
4120 |
|
Then we could use the merged relations approach, and get: |
|
4121 |
|
|
|
4122 |
|
 |
|
4125 |
|
\ |
|
4126 |
|
|
|
4127 |
|
We picked KeyA to be the primary key for the same reason as before. |
|
4128 |
|
Note that merging the two entities into one relation also means that you have eventually to do some work on the relations that were referring to them. |
|
4129 |
|
|
|
4130 |
|
Of course, if ENT.A and ENT.B are the same entity (that is, REL is recursive), we would get: |
|
4131 |
|
|
|
4132 |
|
 |
|
4135 |
|
\ |
|
4136 |
|
|
|
4137 |
|
or |
|
4138 |
|
|
|
4139 |
|
 |
|
4143 |
|
\ |
|
4144 |
|
|
|
4145 |
|
depending on the approach we chose. |
|
4146 |
|
|
|
4147 |
|
Binary $1:N$ and binary $M:N$ relationships are dealt with in a similar way, using foreign key or cross-reference approaches. |
|
4148 |
|
The most difficult part of the mapping is with $n$-ary relationships: we have to use cross-reference approaches, but determining the primary key is not an easy task. |
|
4149 |
|
Consider the following^[This developement was actually asked at <https://dba.stackexchange.com/q/232068/>.]: |
|
4150 |
|
|
|
4151 |
|
 |
|
4152 |
|
|
|
4153 |
|
The arity constraints here can be rephrased as: |
|
4154 |
|
|
|
4155 |
|
- A member can reserve a particular equipment at multiple time slots (the $N$), |
|
4156 |
|
- An equipment can be reserved at a particular time slot by only one member (the $1$ on the left), |
|
4157 |
|
- A member can reserve only one equipment per time slot (the $1$ on the right). |
|
4158 |
|
|
|
4159 |
|
And note that there is no total participation constraint. |
|
4160 |
|
|
|
4161 |
|
To reprent the RESRVES relationship, we need to create a relation with attributes referencing the primary key of MEMBER, the primary key of TIME\_SLOT, and the primary key of EQUIPMENT. |
|
4162 |
|
Making them all the primary key does not represent the fact that the same equipment cannot be booked twice during the same slot, nor that a member can book only one equipment per slot, but allows members to reserve a particular equipment at multiple time slots. |
|
4163 |
|
To improve this situation, we can either |
|
4164 |
|
|
|
4165 |
|
#. take the foreign key to MEMBER and the foreign key to TIME\_SLOT to be the primary key of this relation, |
|
4166 |
|
#. or take the foreign key to EQUIPMENT and the foreign key to TIME\_SLOT to be the primary key of this relation. |
|
4167 |
|
|
|
4168 |
|
Both solutions enforce only _some_ of the requirement expressed by the E.R. diagram. |
4025 |
4169 |
|
|
4026 |
4170 |
|
|
4027 |
4171 |
### Outro |
### Outro |
|
... |
... |
Multivalued attribute | Relation and foreign key |
4038 |
4182 |
Value set | Domain |
Value set | Domain |
4039 |
4183 |
Key attribute | Primary key |
Key attribute | Primary key |
4040 |
4184 |
|
|
4041 |
|
**Worked on PB 2 and 3 of HW4, that needs to be adapted. Needs to be written more properly. Cf. Drawing in Lecture 16's notes.** |
|
4042 |
|
|
|
4043 |
|
**Need to work on a better example, includings $n$-ary relationship, and propagate options.** |
|
|
4185 |
|
You can have a look at e.g. <http://holowczak.com/converting-e-r-models-to-relational-models/> to get a slightly different explanation of this conversion, and additional pointers. |
4044 |
4186 |
|
|
4045 |
4187 |
|
|
4046 |
4188 |
## Guidelines and Normal Form |
## Guidelines and Normal Form |
|
... |
... |
Goals: |
4054 |
4196 |
#. Minimum redundancy |
#. Minimum redundancy |
4055 |
4197 |
#. Make queries easy (avoid redundant work, make `select` / `join` easy) |
#. Make queries easy (avoid redundant work, make `select` / `join` easy) |
4056 |
4198 |
|
|
|
4199 |
|
For E.R. diagrams, some of the usual techniques^[Cf. for instance <http://infolab.stanford.edu/~ullman/fcdb/aut07/slides/er.pdf>.] are: |
|
4200 |
|
|
|
4201 |
|
- Limit the use of weak entity sets. |
|
4202 |
|
- Don't use an entity when an attribute will do. |
|
4203 |
|
|
4057 |
4204 |
### General rules |
### General rules |
4058 |
4205 |
|
|
4059 |
4206 |
#### Semantics |
#### Semantics |
|
... |
... |
Think about their dependencies, and list them: |
4152 |
4299 |
|
|
4153 |
4300 |
"What *is*.", can disprove some of the assumptions made previously, but shouldn't add new dependencies based on it (they may be by chance!). |
"What *is*.", can disprove some of the assumptions made previously, but shouldn't add new dependencies based on it (they may be by chance!). |
4154 |
4301 |
|
|
4155 |
|
- Maybe `TEACHER.Office` → `TEACHER.Name` does not hold, because teachers share office? |
|
4156 |
|
- Maybe `TEACHER.Name` → `MARKER.Brand` and `MARKER.Color` hold? |
|
|
4302 |
|
- Maybe `TEACHER.Office` → `TEACHER.Name` does not hold, because teachers share offices? |
|
4303 |
|
- Maybe `TEACHER.Name` → `MARKER.Brand` and `MARKER.Color` seemed to be enforced by the state, but we should not add a functional dependency based on that: there are no "requirement" that a Teacher must always buy the same brand and color, this could simply true be by chance so far and should not be imposed to the teachers. |
4157 |
4304 |
|
|
4158 |
4305 |
A particular state cannot enforce a FD, but it can negate one. |
A particular state cannot enforce a FD, but it can negate one. |
4159 |
4306 |
|
|
|
... |
... |
For each attribute $A$ of the relation whose primary key is $A_1, …, A_n$: |
4311 |
4458 |
- Remove $A$ from the original relation, as well as all the functional dependencies involving it, |
- Remove $A$ from the original relation, as well as all the functional dependencies involving it, |
4312 |
4459 |
- Add a foreign key from $\{A'_1, …, A'_k\}$ to their original counterparts in the original relation. |
- Add a foreign key from $\{A'_1, …, A'_k\}$ to their original counterparts in the original relation. |
4313 |
4460 |
|
|
4314 |
|
#### Notes and examples |
|
|
4461 |
|
#### Examples |
|
4462 |
|
|
|
4463 |
|
We can have a look at another example: |
|
4464 |
|
|
|
4465 |
|
 |
|
4466 |
|
|
|
4467 |
|
Note that \{State, Driver\_Licence\_Num\}, would be a valid primary key for this relation, and that adding it would make it a relation in 1NF. |
|
4468 |
|
|
|
4469 |
|
As we can see, the name "Driver" is somehow counter-intuitive, since the relation also carries information about Governors. |
|
4470 |
|
This relation is actually not in 2NF, because the FD \{State, Driver\_Licence\_Num\} → Governor is not fully functional. |
|
4471 |
|
A possible way to fix it is to get: |
|
4472 |
|
|
|
4473 |
|
 |
|
4474 |
|
|
|
4475 |
|
As you can see, the 2NF helped us in separating properly the entities. |
|
4476 |
|
|
|
4477 |
|
An example of a relation that is in 2NF but not in 3NF could be: |
|
4478 |
|
|
|
4479 |
|
 |
|
4480 |
|
|
|
4481 |
|
As we can see, all the non-prime attributes are fully functionaly dependent from Login, which is our primary key. |
|
4482 |
|
But, obviously, one of this dependecy is transitive, and breaks the 3NF. |
|
4483 |
|
A way to fix it is: |
|
4484 |
|
|
|
4485 |
|
 |
4315 |
4486 |
|
|
4316 |
|
CCL: every FD $X → Y$ s.t. $X$ is a proper subset of the primary key, or a non-prime attribute, is problematic. |
|
|
4487 |
|
As we can see, 3NF also helped us in separating properly the entities, in a slightly different way. |
|
4488 |
|
|
|
4489 |
|
In conclusion, we can observe that every FD $X → Y$ s.t. $X$ is a proper subset of the primary key, or a non-prime attribute, is problematic. |
4317 |
4490 |
2NF is a guarantee that every entity has its own relation, 3NF is a way to avoid data inconsistency. |
2NF is a guarantee that every entity has its own relation, 3NF is a way to avoid data inconsistency. |
4318 |
4491 |
|
|
4319 |
4492 |
--- |
--- |
|
... |
... |
This last feature can be used for weak entities, but not only. |
4420 |
4593 |
|
|
4421 |
4594 |
Some of those subtleties depend on your need, and are subjective, but are important tool to design properly a database, and relieving the programmer from the burden of figuring out many details. |
Some of those subtleties depend on your need, and are subjective, but are important tool to design properly a database, and relieving the programmer from the burden of figuring out many details. |
4422 |
4595 |
|
|
|
4596 |
|
<!-- |
4423 |
4597 |
### Missing? |
### Missing? |
4424 |
4598 |
|
|
4425 |
4599 |
On Generalization |
On Generalization |
|
... |
... |
and |
4429 |
4603 |
Example of Use Case |
Example of Use Case |
4430 |
4604 |
|
|
4431 |
4605 |
**Example: cf. review session.** |
**Example: cf. review session.** |
4432 |
|
|
|
|
4606 |
|
--> |
4433 |
4607 |
|
|
4434 |
4608 |
## Exercises {-} |
## Exercises {-} |
4435 |
4609 |
|
|
|
... |
... |
Author\_name | → | Author\_affil |
5219 |
5393 |
|
|
5220 |
5394 |
--- |
--- |
5221 |
5395 |
|
|
5222 |
|
|
|
5223 |
|
Problem (From UML to relational model -- DRIVER) +.#UMLtoRELDriver |
|
5224 |
|
~ |
|
5225 |
|
|
|
5226 |
|
Consider the UML diagram below, and convert it to the relational model. |
|
5227 |
|
Don't forget to indicate primary and foreign keys. |
|
5228 |
|
|
|
5229 |
|
 |
|
5230 |
|
|
|
5231 |
|
--- |
|
5232 |
|
|
|
5233 |
5396 |
Problem (Normal form of the CONTACT relation) +.#NormalizeContact |
Problem (Normal form of the CONTACT relation) +.#NormalizeContact |
5234 |
5397 |
~ |
~ |
5235 |
5398 |
|
|
|
... |
... |
Problem (From business statements to dependencies -- KEYBOARD) +.#BusinessToDepe |
5323 |
5486 |
#. Based on those statements, what could be a key for this relation? |
#. Based on those statements, what could be a key for this relation? |
5324 |
5487 |
#. Assuming all those functional dependencies hold, and taking the primary key you identified at the previous step, what is the degree of normality of this relation? Justify your answer. |
#. Assuming all those functional dependencies hold, and taking the primary key you identified at the previous step, what is the degree of normality of this relation? Justify your answer. |
5325 |
5488 |
|
|
|
5489 |
|
--- |
|
5490 |
|
|
|
5491 |
|
Problem (From UML to relational model -- DRIVER) +.#UMLtoRELDriver |
|
5492 |
|
~ |
|
5493 |
|
|
|
5494 |
|
Consider the UML diagram below, and convert it to the relational model. |
|
5495 |
|
Don't forget to indicate primary and foreign keys. |
|
5496 |
|
|
|
5497 |
|
 |
|
5498 |
|
|
5326 |
5499 |
|
|
5327 |
5500 |
## Solution to Selected Problems {-} |
## Solution to Selected Problems {-} |
5328 |
5501 |
|
|