Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Fixing NF part. | 111dff5a3e9d04c66644b07bf1b57f042397acdc | caubert | 2021-10-15 17:34:08 |
Added exam 1 | d0dd69017e6ec6a7c476fef569e4e6480230e099 | caubert | 2021-09-20 13:53:49 |
Fixed vote rel. model. | 579bcb33b94039787bdb5f477394b428f0249666 | caubert | 2021-09-17 19:00:31 |
Added some precision following course. | b5b1e27b4190ddc10df2b0383bed289be8d7a556 | caubert | 2021-09-01 18:34:26 |
Added example about self-referencing tuple. | 0392e724d84f2a9264fec4be188fa74ef795266a | caubert | 2021-08-30 18:56:34 |
Clarified what a mini-world is. | 7bc9938cbdcc8be11cd61c74899b330d626ec2b5 | caubert | 2021-08-25 16:23:12 |
Added emoji support and cleaned. | f7b577db596410737f72c93fbcab615b53226ac5 | aubert@math.cnrs.fr | 2021-08-17 13:35:36 |
Finished final from previous semester. | 7622ebd223bbbabaed014a175a0be5da7aff5d6f | caubert | 2021-08-13 17:05:28 |
Added final for Spring 2021. | 6a4a0d94151df7ab940c814637be8ee5136de850 | caubert | 2021-08-13 16:55:09 |
Typo | f1acfa7bcd31233571e74e176ee2a38880c08d72 | caubert | 2021-05-07 02:55:17 |
Added second problem of final. | 38c448de2d0e38bf50efcf1b1da3e0a45def1707 | caubert | 2021-05-07 01:42:05 |
Added first exercise of final. | df858593f1d47ff3442bcb6216b90605d81e0e1c | caubert | 2021-05-06 22:26:09 |
Fixed mongo db and added quiz 4$ | 7f0f4b98f4b293927185ed3cb080554eb3af867c | caubert | 2021-04-23 19:15:53 |
Finishing with Exam 2 | 4e0eb343744b5f39ac32145ca7dc61a26b3f48ee | caubert | 2021-04-09 20:33:48 |
Added problem and solution of second exam | 2b344a25e84c7ebc827c1503151981380ec08f31 | caubert | 2021-04-07 18:08:08 |
Worked on exam 2 | 649fce8b5cbc3f5a98ae905ae8cc56d8baa5df99 | caubert | 2021-04-06 19:18:54 |
Clarification on sql injection. | f9450ef20ef15cc048c1c2775cbf5e29c4be7255 | caubert | 2021-03-31 14:56:56 |
Added an example of batch processing of prepared statement. | f83adc39b5066412fa78fdc0aeccb51ccdba908a | caubert | 2021-03-31 13:39:52 |
Added an example of batch processing of prepared statement. | c206f2899162396a7f391728db8be23031253454 | caubert | 2021-03-31 13:38:48 |
Fixed pb (CONSULTATION relation: justification, primary key and normal form) | 14aef6161421064f879c5fe803abb4836eebba0a | caubert | 2021-03-25 20:58:59 |
File | Lines added | Lines deleted |
---|---|---|
notes/example.md | 4 | 1 |
notes/fig/fd/course_norm_01.tex | 1 | 1 |
notes/fig/fd/example_2NF_02.tex | 2 | 2 |
notes/fig/fd/example_2NF_03.tex | 1 | 1 |
notes/lectures_notes.md | 9 | 9 |
File notes/example.md changed (mode: 100644) (index 9289c51..effe12d) | |||
... | ... | This is an example that shows how to include a UML activity diagram: | |
81 | 81 | # Code Examples | # Code Examples |
82 | 82 | ||
83 | 83 | By defaut, the code is colored as `SQL` code, due to the | By defaut, the code is colored as `SQL` code, due to the |
84 | ```--lua-filter filters/default-code-class.lua -M default-code-class=sqlmysql``` | ||
84 | |||
85 | ``` | ||
86 | --lua-filter filters/default-code-class.lua -M default-code-class=sqlmysql | ||
87 | ``` | ||
85 | 88 | option given to pandoc. | option given to pandoc. |
86 | 89 | You can refer to <https://github.com/jgm/pandoc/issues/2104> for a discussion on that topic. | You can refer to <https://github.com/jgm/pandoc/issues/2104> for a discussion on that topic. |
87 | 90 |
File notes/fig/fd/course_norm_01.tex changed (mode: 100644) (index 9e63b26..5a8b407) | |||
10 | 10 | \depedge[lvl=1]{3}{5}{} | \depedge[lvl=1]{3}{5}{} |
11 | 11 | \depedge[lvl=1]{2}{4}{} | \depedge[lvl=1]{2}{4}{} |
12 | 12 | \depedge[lvl=1]{8}{9}{} | \depedge[lvl=1]{8}{9}{} |
13 | \depedge[lvl=1, FK, edge above]{8}{3}{} | ||
13 | \depedge[lvl=1, FK, edge above]{3}{8}{} | ||
14 | 14 | \end{dependency} | \end{dependency} |
15 | 15 | ||
16 | 16 | \end{document} | \end{document} |
File notes/fig/fd/example_2NF_02.tex changed (mode: 100644) (index c364a66..5478144) | |||
9 | 9 | \depedge[lvl=1]{3}{4}{} | \depedge[lvl=1]{3}{4}{} |
10 | 10 | \depedge[lvl=1]{7}{8}{} | \depedge[lvl=1]{7}{8}{} |
11 | 11 | \depedge[lvl=1]{11}{12}{} | \depedge[lvl=1]{11}{12}{} |
12 | \depedge[lvl=1, FK, edge above]{7}{3}{} | ||
13 | \depedge[lvl=1, FK, edge above]{11}{3}{} | ||
12 | \depedge[lvl=1, FK, edge above]{3}{7}{} | ||
13 | \depedge[lvl=1, FK, edge above]{3}{11}{} | ||
14 | 14 | \end{dependency} | \end{dependency} |
15 | 15 | ||
16 | 16 | \end{document} | \end{document} |
File notes/fig/fd/example_2NF_03.tex changed (mode: 100644) (index be82209..f274450) | |||
9 | 9 | \depedge[lvl=1]{3}{4}{} | \depedge[lvl=1]{3}{4}{} |
10 | 10 | \depedge[lvl=1]{7}{8}{} | \depedge[lvl=1]{7}{8}{} |
11 | 11 | \depedge[lvl=1]{7}{9}{} | \depedge[lvl=1]{7}{9}{} |
12 | \depedge[lvl=1, FK, edge above]{7}{3}{} | ||
12 | \depedge[lvl=1, FK, edge above]{3}{7}{} | ||
13 | 13 | % \depedge[lvl=1, FK, edge above]{11}{3}{} | % \depedge[lvl=1, FK, edge above]{11}{3}{} |
14 | 14 | \end{dependency} | \end{dependency} |
15 | 15 |
File notes/lectures_notes.md changed (mode: 100644) (index ea61950..ffc95ad) | |||
... | ... | A FD : $X → Y$ is a **transivive dependency** if there exist a set of attribut | |
6394 | 6394 | ||
6395 | 6395 | ### Normal Forms and Keys | ### Normal Forms and Keys |
6396 | 6396 | ||
6397 | First, Second, Third, Fourth, Fifth normal form ("X"NF). | ||
6398 | Stronger than the Third, there is the Boyce-Codd NF (BCNF) | ||
6399 | |||
6400 | If you satisfy $N$, you satisfy $N-1$, $N-2$, etc. | ||
6397 | There exists multiple normal forms: First, Second, Third, Fourth, Fifth normal form ("X"NF), … | ||
6398 | Stronger than the Third, there is the Boyce-Codd NF (BCNF), but we will focus on the first three, that are "cumulative": to you satisfy $N$, a relation have to satisfy $N-1$, $N-2$, etc. | ||
6401 | 6399 | The *normal form* of a relation is the highest normal form condition that it meets. | The *normal form* of a relation is the highest normal form condition that it meets. |
6402 | 6400 | ||
6403 | 6401 | #### Fist Normal Form | #### Fist Normal Form |
... | ... | Hence, we will always assume that a primary key is given, and it will be underli | |
6412 | 6410 | ||
6413 | 6411 | ##### Normalization | ##### Normalization |
6414 | 6412 | ||
6415 | **To be written** | ||
6413 | This essentially consists in | ||
6414 | - Picking a primary key, | ||
6415 | - Making the complex and multi-valued attributes atomic, following what was done when mapping entity-relationship models to relational models: by either "flattening" the complex attribute (i.e., picking the attributes composing it) or by creating a relation that will allow to store multiple values and linking it to the original relation. | ||
6416 | 6416 | ||
6417 | 6417 | #### Second Normal Form | #### Second Normal Form |
6418 | 6418 | ||
... | ... | For each attribute $A$ of the relation whose primary key is $A_1, …, A_n$: | |
6431 | 6431 | - Yes, it depends only of $\{A'_1, …, A'_k\}$ → Do the following: | - Yes, it depends only of $\{A'_1, …, A'_k\}$ → Do the following: |
6432 | 6432 | - Create a new relation with $A$ and $\{A'_1, …, A'_k\}$, make $\{A'_1, …, A'_k\}$ the primary key, and "import" all the functional dependencies, | - Create a new relation with $A$ and $\{A'_1, …, A'_k\}$, make $\{A'_1, …, A'_k\}$ the primary key, and "import" all the functional dependencies, |
6433 | 6433 | - Remove $A$ from the original relation, and all the functional dependencies that implied it, | - Remove $A$ from the original relation, and all the functional dependencies that implied it, |
6434 | - Add a foreign key from $\{A'_1, …, A'_k\}$ to their original counterparts in the original relation. | ||
6434 | - Add a foreign key to $\{A'_1, …, A'_k\}$ from their original counterparts in the original relation. | ||
6435 | 6435 | ||
6436 | 6436 |  |  |
6437 | 6437 | ||
... | ... | For instance, considering | |
6445 | 6445 | ||
6446 | 6446 |  |  |
6447 | 6447 | ||
6448 | applying the algorithm would give | ||
6448 | applying the algorithm would give (the incorrect, since a foreign key can not refer two attributes in two different tables) | ||
6449 | 6449 | ||
6450 | 6450 |  |  |
6451 | 6451 | ||
... | ... | whereas a more subtle algorithm would give | |
6453 | 6453 | ||
6454 | 6454 |  |  |
6455 | 6455 | ||
6456 | Note that in both cases, all the relations are in Second Normal Form, though. | ||
6456 | Note that in both cases, all the relations are in Second Normal Form, though (and valid if we ignore the foreign key issue discussed above). | ||
6457 | 6457 | ||
6458 | 6458 | Note also that, sometimes, removing the "original" relation may be preferable: cf. an example in [%D %n (%T)](#problem:coffeeNF). | Note also that, sometimes, removing the "original" relation may be preferable: cf. an example in [%D %n (%T)](#problem:coffeeNF). |
6459 | 6459 | ||
6460 | Note also that if our primary key is a singleton, then there is nothing to do, we are in 2NF as soon as we are in 1NF. | ||
6460 | Note also that if our primary key is a singleton (a set with only one element), then there is nothing to do, we are in 2NF as soon as we are in 1NF: every functional dependency from a single element is always full! | ||
6461 | 6461 | ||
6462 | 6462 | #### Third Normal Form | #### Third Normal Form |
6463 | 6463 |