List of commits:
Subject Hash Author Date (UTC)
Added final exam. fb37cf99312795016ddbc2e859b055051bcedd13 aubert@math.cnrs.fr 2020-05-08 21:11:57
Refined ccs style + added foldable toc. 95b1663a7b8294dd401d796fb545a67bddba0a01 aubert@math.cnrs.fr 2020-05-07 19:02:27
Refined ccs style + added foldable toc. c208eee4f769e99415efa57a7f03081db87ec3db aubert@math.cnrs.fr 2020-05-07 18:02:53
Fixing indent in xml and notes. ace8f38f8e0374005d143ebaa32d47a209fb5a48 aubert@math.cnrs.fr 2020-04-27 18:42:28
NoSQL application detailled. f2030de09eb58462e04935ec83c71d3c1fc72469 aubert@math.cnrs.fr 2020-04-27 18:28:02
Added automatic anchors. 2ddb93394121bcf95f91bfed8b447966925afa6f aubert@math.cnrs.fr 2020-04-27 05:35:14
added missing file 480b503949518eb51fd324a6f6bbb8f6d5643f0d aubert@math.cnrs.fr 2020-04-24 02:11:09
Worked on MongoDB section. 70f041d53a14bbb5ace0a4ef40f3e67eca285309 aubert@math.cnrs.fr 2020-04-22 19:18:55
Edited KNOWN_BUGS. b90ca71b498016b17963373ead24873781181bfd aubert@math.cnrs.fr 2020-04-22 05:12:14
Minor edits on narrative. d927955c1269ff1b110057577e50705fd41f4e2d aubert@math.cnrs.fr 2020-04-22 05:07:48
Worked on migrating code to snippets. 1ce6f6ba150a1cace57445330801e8b17f6c3044 aubert@math.cnrs.fr 2020-04-22 04:15:37
Edited Sol of 4.28, Pb and Sol of 4.29, checked Pb 4.30, edited Pb 4.31, edited the DB Applications Resources section, checked Pb 5.1, edited Pb 5.2 and Sol 5.2, Pb and Sol of 6.1, Pb 7.1, checked Pb 7.2, edited Sol 7.2, Pb and Sol of Pb 7.3, checked Ex 7.1 and edited its solution, checked Ex 7.2 and edited its solution, edited Ex and Sol of 7.3, Ex and Sol of 7.4 edited Ex 7.5 and checked its solution, edited Ex and Sol of 6.1, Ex and Sol of 6.2, checked Ex 6.3 and edited its solution, checked Ex 5.1 and edited its solution, checked Ex 5.2 and edited its solution, edited Ex and Sol of 5.3, checked Ex and Sol of 5.4, checked Ex 5.5 and edited its solution, and edited Ex and Sol of 5.6. 6580a85df655eddd149bb5531a0615ddfe9f810e Crystal 2020-04-22 03:02:20
Disabled Scrolling of sql files in html and enabled resize option 87d4ef4185fe48a7503724eb98a6c486c351ddee pveeral@augusta.edu 2020-04-21 15:49:36
Updated list of bugs. 17827a6a5b127fa6449b495c1e07359da4682100 aubert@math.cnrs.fr 2020-04-20 19:24:01
Worked on nosql chapter. 38dfcfffce7c06d0eab7256a7a5be1e2481a8505 aubert@math.cnrs.fr 2020-04-20 17:52:55
ALT in img folder 6e6469575d825f6c7360b88d6b387aee709b643c pveeral@augusta.edu 2020-04-20 15:26:47
Cleaned up bib file. 505b1000bca31e4d833bf7739d02d2b7e727e69b aubert@math.cnrs.fr 2020-04-20 05:03:18
rapid adjustments in contrib beb43332953ec4e2a8e4376a90ce58b1234eadba aubert@math.cnrs.fr 2020-04-20 00:10:44
Updated CONTRIB.md c29d920e1efbc84766a3caafc0db2fcab4220b32 pveeral@augusta.edu 2020-04-19 19:28:45
testing 4ece7ba3d5c5d99361ef5eac92bb0848f2ea5318 pveeral@augusta.edu 2020-04-19 18:27:50
Commit fb37cf99312795016ddbc2e859b055051bcedd13 - Added final exam.
Author: aubert@math.cnrs.fr
Author date (UTC): 2020-05-08 21:11
Committer name: aubert@math.cnrs.fr
Committer date (UTC): 2020-05-08 21:11
Parent(s): 95b1663a7b8294dd401d796fb545a67bddba0a01
Signer:
Signing key:
Signing status: N
Tree: 47e5719e95507e4af684d6dbc3f303f6672493af
File Lines added Lines deleted
notes/Makefile 1 1
notes/code/sql/HW_ComputerVariation.sql 59 0
notes/code/sql/HW_SocialMedia.sql 162 0
notes/fig/er/incorrect.tex 60 0
notes/lectures_notes.md 153 9
File notes/Makefile changed (mode: 100644) (index e5f768e..0ed1e7b)
... ... MAKEFLAGS:= -j
14 14 OPTIONSPANDOC:= --toc --filter pandoc-numbering --filter pandoc-citeproc --filter pandoc-include-code --top-level-division=chapter -M date="$$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" --lua-filter filters/default-code-class.lua -M default-code-class=sqlmysql OPTIONSPANDOC:= --toc --filter pandoc-numbering --filter pandoc-citeproc --filter pandoc-include-code --top-level-division=chapter -M date="$$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" --lua-filter filters/default-code-class.lua -M default-code-class=sqlmysql
15 15 # Options common to all invokations of pandoc. Cf https://pandoc.org/MANUAL.html to understand them. # Options common to all invokations of pandoc. Cf https://pandoc.org/MANUAL.html to understand them.
16 16 OPTIONSPANDOCODT:= $(OPTIONSPANDOC) --default-image-extension=svg OPTIONSPANDOCODT:= $(OPTIONSPANDOC) --default-image-extension=svg
17 OPTIONSPANDOCHTML:= $(OPTIONSPANDOC) --css=style/style.css -B style/anchors_header.html -B style/foldable_toc.html -A style/anchors_footer.html --section-divs --toc-depth=2 --self-contained --default-image-extension=svg
17 OPTIONSPANDOCHTML:= $(OPTIONSPANDOC) --css=style/style.css -B style/foldable_toc.html -B style/anchors_header.html -A style/anchors_footer.html --section-divs --toc-depth=2 --self-contained --default-image-extension=svg
18 18 OPTIONSPANDOCPDF:= $(OPTIONSPANDOC) --pdf-engine=xelatex --pdf-engine-opt=-shell-escape -V links-as-notes --default-image-extension=pdf OPTIONSPANDOCPDF:= $(OPTIONSPANDOC) --pdf-engine=xelatex --pdf-engine-opt=-shell-escape -V links-as-notes --default-image-extension=pdf
19 19 # Options for (respectively) the odt, html and pdf outputs. # Options for (respectively) the odt, html and pdf outputs.
20 20 .DEFAULT_GOAL:= all .DEFAULT_GOAL:= all
File notes/code/sql/HW_ComputerVariation.sql changed (mode: 100644) (index d030cba..7c462f1)
... ... DROP SCHEMA IF EXISTS HW_ComputerVariation;
4 4 CREATE SCHEMA HW_ComputerVariation; CREATE SCHEMA HW_ComputerVariation;
5 5 USE HW_ComputerVariation; USE HW_ComputerVariation;
6 6
7 -- start snippet set-up
7 8 CREATE TABLE COMPUTER( CREATE TABLE COMPUTER(
8 9 ID VARCHAR(20) PRIMARY KEY, ID VARCHAR(20) PRIMARY KEY,
9 10 Model VARCHAR(20) Model VARCHAR(20)
 
... ... INSERT INTO PERIPHERAL VALUES
31 32 ('15', 'IBM Selectric', 'keyboard'); ('15', 'IBM Selectric', 'keyboard');
32 33 INSERT INTO CONNEXION VALUES INSERT INTO CONNEXION VALUES
33 34 ('A', '12'), ('B', '14'), ('A', '15'); ('A', '12'), ('B', '14'), ('A', '15');
35 -- end snippet set-up
36
37
38 /*
39 *
40 *
41 * Below are the solution, but think about it first!
42 *
43 *
44 *
45 */
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 -- start snippet solution
65 SELECT Model
66 FROM COMPUTER
67 WHERE ID = 'A';
68
69 SELECT Type
70 FROM PERIPHERAL
71 WHERE ID = '14';
72
73 SELECT Model
74 FROM PERIPHERAL
75 WHERE Type = 'printer';
76
77 SELECT Model
78 FROM PERIPHERAL
79 WHERE Model LIKE 'IBM%';
80
81 SELECT Model
82 FROM PERIPHERAL, CONNEXION
83 WHERE Computer = 'A'
84 AND
85 Peripheral = PERIPHERAL.ID;
86
87 SELECT COUNT(Computer)
88 FROM CONNEXION, COMPUTER
89 WHERE Model = 'Apple IIc Plus'
90 AND
91 Computer = COMPUTER.ID;
92 -- end snippet solution
File notes/code/sql/HW_SocialMedia.sql added (mode: 100644) (index 0000000..3049161)
1 /* code/sql/HW_SocialMedia.sql */
2
3 DROP SCHEMA IF EXISTS HW_SocialMedia;
4 CREATE SCHEMA HW_SocialMedia;
5 USE HW_SocialMedia;
6
7 -- start snippet set-up
8 CREATE TABLE ACCOUNT(
9 ID INT PRIMARY KEY,
10 Name VARCHAR(25),
11 Email VARCHAR(25) UNIQUE
12 );
13
14 CREATE TABLE SUBSCRIBE(
15 Subscriber INT,
16 Subscribed INT,
17 Date DATE,
18 FOREIGN KEY (Subscriber) REFERENCES ACCOUNT(ID),
19 FOREIGN KEY (Subscribed) REFERENCES ACCOUNT(ID),
20 PRIMARY KEY (Subscriber, Subscribed)
21 );
22
23 CREATE TABLE VIDEO(
24 ID INT PRIMARY KEY,
25 Title VARCHAR(25),
26 Released DATE,
27 Publisher INT,
28 FOREIGN KEY (Publisher) REFERENCES ACCOUNT(ID)
29 );
30
31 CREATE TABLE THUMBS_UP(
32 Account INT,
33 Video INT,
34 Date DATE,
35 PRIMARY KEY (Account, Video),
36 FOREIGN KEY (Account) REFERENCES ACCOUNT(ID),
37 FOREIGN KEY (Video) REFERENCES VIDEO(ID)
38 );
39
40 INSERT INTO ACCOUNT VALUES
41 (1, "Bob Ross", "bob@ross.com"),
42 (2, NULL, "anon@fai.com"),
43 (3, "Martha", NULL);
44
45 INSERT INTO SUBSCRIBE VALUES
46 (2, 1, DATE"2020-01-01"),
47 (3, 1, DATE"2019-03-03"),
48 (3, 2, DATE"2019-03-03"),
49 (2, 2, DATE"2019-03-03"),
50 (1, 2, DATE"2019-03-03");
51 -- The first entry means that 2 subscribed to 1, not the other way around.
52 -- And similarly for the other entries.
53
54 INSERT INTO VIDEO VALUES
55 (10, "My first video!", DATE"2020-02-02", 1),
56 (20, "My second video!", DATE"2020-02-03", 1),
57 (30, "My vacations", DATE"2020-02-04", 2);
58
59 INSERT INTO THUMBS_UP VALUES
60 (2, 10, DATE"2020-02-02"),
61 (3, 10, DATE"2020-02-02"),
62 (2, 20, DATE"2020-02-02"),
63 (1, 30, DATE"2020-02-05");
64
65 -- end snippet set-up
66
67 /*
68 *
69 *
70 * Below are the solution, but think about it first!
71 *
72 *
73 *
74 */
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94 -- start snippet solution
95
96 -- … the title of all the videos ("My first video!", "My second video!", "My vacations").
97 SELECT TITLE
98 FROM VIDEO;
99
100 -- … the release date of the video whose title is "My first video!" ("2020-02-02").
101 SELECT Released
102 FROM VIDEO
103 WHERE Title = "My first video!";
104
105 -- … the ID of the account(s) where the "Name" attribute was not given ("2").
106 SELECT ID
107 FROM ACCOUNT
108 WHERE Name IS NULL;
109
110 -- … the ID of the videos whose title contains the word "video" ("10", "20").
111 SELECT ID
112 FROM VIDEO
113 WHERE TITLE LIKE "%video%";
114
115 -- or
116
117 SELECT ID
118 FROM VIDEO
119 WHERE Title REGEXP 'video';
120
121 -- … the number of thumbs up for the video with title "My vacations" ("1").
122 SELECT COUNT(*) FROM THUMBS_UP, VIDEO
123 WHERE VIDEO.Title="My vacations"
124 AND
125 VIDEO.ID = THUMBS_UP.Video;
126
127 -- … the title of the oldest video ("My first video!").
128 SELECT Title
129 FROM VIDEO
130 WHERE Released <= ALL (
131 SELECT Released FROM VIDEO
132 );
133
134 -- or
135
136 SELECT Title
137 FROM VIDEO
138 WHERE Released = (
139 SELECT Min(Released) FROM VIDEO
140 );
141
142 -- or even
143
144 SELECT Title
145 FROM VIDEO
146 ORDER BY Released
147 ASC LIMIT 1;
148
149 -- … the names of the accounts who gave a thumbs up to the video with id 30 ("Bob Ross").
150 SELECT Name FROM ACCOUNT, THUMBS_UP
151 WHERE THUMBS_UP.Video = 30
152 AND
153 THUMBS_UP.Account = ACCOUNT.ID;
154
155 -- … the ID of the account with the greatest number of subscribers ("2").
156 SELECT Subscribed
157 FROM SUBSCRIBE
158 GROUP BY Subscribed
159 ORDER BY COUNT(Subscriber) DESC
160 LIMIT 1;
161
162 -- end snippet solution
File notes/fig/er/incorrect.tex added (mode: 100644) (index 0000000..944fb65)
1 \documentclass[border=20pt]{standalone}
2 \input{template.def}
3
4 \begin{tikzpicture}[node distance=1.5cm]
5 \node[entity] (PROJECT) {PROJECT};
6 \node[attribute] [above of=PROJECT] {\key{Name}} edge (PROJECT);
7 \node[attribute] [right = .5cm of PROJECT] {url} edge (PROJECT);
8 \node[attribute] (leader) [above right = .5cm of PROJECT] {leader} edge (PROJECT);
9 \node[attribute] [above right = .5cm of leader] {Name} edge (leader);
10 \node[attribute] [right = .5cm of leader] {Email} edge (leader);
11 %
12 \node[ident relationship] (RECOMMENDEDBY) [left = 1.5cm of PROJECT] {RECOMMENDED\_BY} edge node[above, pos=0.4] {$1$} (PROJECT);
13 %
14 \node[weak entity] (GUIDELINES) [left = 1.5cm of RECOMMENDEDBY] {GUIDELINES} edge node[above, pos=0.6]{$\cM$} (RECOMMENDEDBY);
15 \node[attribute] [above left = .5cm of GUIDELINES] {\pkey{url}} edge (GUIDELINES);
16 \node[attribute] (ide) [left = 0.5cm of GUIDELINES] {Recommended IDE} edge (GUIDELINES);
17 \node[attribute] (ide) [below left = 0.5cm of GUIDELINES] {Coding Style} edge (GUIDELINES);
18 %
19 \node[relationship] (USES) [below =1.5cm of PROJECT] {USES} edge (PROJECT);
20 %
21 \node[entity] (PROGRAMMINGLANGUAGE) [below = 5cm of PROJECT] {PROGRAMMING\_LANGUAGE} edge node[right, pos=0.4] {$1$} (USES);
22 % \node[attribute] [right = .5cm of PROGRAMMINGLANGUAGE] {\key{Name}} edge (PROGRAMMINGLANGUAGE);
23 \node[multi attribute] [below = .5cm of PROGRAMMINGLANGUAGE] {Version} edge (PROGRAMMINGLANGUAGE);
24 \node[derived attribute] [below right = .5cm of PROGRAMMINGLANGUAGE] {Latest Version} edge (PROGRAMMINGLANGUAGE);
25 %
26 \node[entity] (PROGRAMMER) [below = 5cm of GUIDELINES] {PROGRAMMER};% edge node[right, pos=0.4] {$1$} (USES);
27 \node[attribute] [left = .5cm of PROGRAMMER] {\key{Name}} edge (PROGRAMMER);
28 \node[attribute] [below left = .5cm of PROGRAMMER] {\key{Email}} edge (PROGRAMMER);
29 \node[attribute] [above left = .5cm of PROGRAMMER] {\key{id}} edge (PROGRAMMER);
30 %
31 \node[relationship] (KNOWS) [right =1.5cm of PROGRAMMER] {KNOWS} edge [total] node[above, pos=0.4] {$1$} (PROGRAMMINGLANGUAGE) edge [total] node[above, pos=0.4] {$\cM$} (PROGRAMMER);
32 %
33 %
34 \node[relationship] (CONTRIBUTESTO) [above right =1.5cm of PROGRAMMER] {CONTRIBUTES\_TO} edge [total] node[above, pos=0.4] {$1$} (PROJECT) edge [total] node[above, pos=0.4] {$1$} (PROGRAMMER);
35 %
36
37 %\node[entity] (PROJECT) {PROJECT};
38 %
39 %
40 %
41 %\node[relationship] (SPEAKS) [below right of=PROJECT] {SPEAKS} edge node[right, pos=0.4] {$M$} (PROJECT);
42 %\node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS);
43 %\node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE);
44 %\node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE);
45 %
46 %\node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F};
47 %\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west);
48 %\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east);
49 %
50 %
51 %\node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem);
52
53 %
54 %\node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN};
55 %\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN);
56 %\draw (anthem) to node[right, pos=0.6] {$M$} (WIN);
57
58 \end{tikzpicture}
59
60 \end{document}
File notes/lectures_notes.md changed (mode: 100644) (index d83615e..84ef1b6)
... ... The quizzes are not indicated, but were generally a mix of up to five exercises
123 123
124 124 ### Spring 2020 {-} ### Spring 2020 {-}
125 125
126 Due to the Covid-19 pandemic, only one exam took place, and the final exam was taken remotely on D2L.
127 A second project, more ambitious, was also asked from the students, and accounted for a large portion of their grade.
128
126 129 - Project #1: [%D %n (%T)](#problem:project1) - Project #1: [%D %n (%T)](#problem:project1)
127 130 - Exam #1: - Exam #1:
128 131 - [%D %n (%T)](#problem:residency) - [%D %n (%T)](#problem:residency)
129 132 - [%D %n (%T)](#problem:rel_model_auction_website) - [%D %n (%T)](#problem:rel_model_auction_website)
133 - Final:
134 - [%D %n (%T)](#problem:SocialMedia), where the last query was treated as a bonus, due to its difficulty.
135 - [%D %n (%T)](#problem:explainNosql)
136 - [%D %n (%T)](#problem:NormalizeDelivery)
137 - [%D %n (%T)](#problem:incorrect-er)
130 138
131 139
132 140 ### Fall 2019 {-} ### Fall 2019 {-}
 
... ... The quizzes are not indicated, but were generally a mix of up to five exercises
159 167 - [%D %n (%T)](#problem:schedule) - [%D %n (%T)](#problem:schedule)
160 168 - [%D %n (%T)](#problem:NormalizeMessage) - [%D %n (%T)](#problem:NormalizeMessage)
161 169 - Final: - Final:
162 - [%D %n (%T)](#problem:explainNosql)
170 - A variation on [%D %n (%T)](#problem:explainNosql)
163 171 - [%D %n (%T)](#problem:book) - [%D %n (%T)](#problem:book)
164 172 - [%D %n (%T)](#problem:network) - [%D %n (%T)](#problem:network)
165 173 - [%D %n (%T)](#problem:ComputerSelectBis) - [%D %n (%T)](#problem:ComputerSelectBis)
 
... ... Problem (Write select queries for the COMPUTER table) +.#ComputerSelect
3810 3818
3811 3819 --- ---
3812 3820
3821 Problem (Write select queries for the SocialMedia schema) +.#SocialMedia
3822 ~
3823
3824 Consider the following `SQL` code:
3825
3826 ```{.sqlmysql .numberLines include=code/sql/HW_SocialMedia.sql snippet=set-up}
3827 ```
3828
3829 Write queries that return the following information. The values returned *in this set-up* will be in parenthesis, but keep the queries general.
3830
3831 #. The title of all the videos (`"My first video!"`, `"My second video!"`, `"My vacations"`).
3832 #. The release date of the video whose title is `"My first video!"` (`"2020-02-02"`).
3833 #. The ID of the account(s) where the "Name" attribute was not given (`"2"`).
3834 #. The ID of the videos whose title contains the word `"video"` (`"10"`, `"20"`).
3835 #. The number of thumbs up for the video with title `"My vacations"` (`"1"`).
3836 #. The title of the oldest video (`"My first video!"`).
3837 #. The names of the accounts who gave a thumbs up to the video with ID 30 (`"Bob Ross"`).
3838 #. The ID of the account with the greatest number of subscribers (`"2"`).
3839
3840
3841 ---
3842
3813 3843
3814 3844 Problem (Write select queries for a variation of the COMPUTER table) +.#ComputerSelectBis Problem (Write select queries for a variation of the COMPUTER table) +.#ComputerSelectBis
3815 3845 ~ ~
3816 3846
3817 3847 Consider the following `SQL` code: Consider the following `SQL` code:
3818 3848
3819 ```{.sqlmysql .numberLines include=code/sql/HW_ComputerVariation.sql}
3849 ```{.sqlmysql .numberLines include=code/sql/HW_ComputerVariation.sql snippet=set-up}
3820 3850 ``` ```
3821 3851
3822 3852 Write queries that return the following information. The values returned *in this set-up* will be in parenthesis, but keep the queries general. Write queries that return the following information. The values returned *in this set-up* will be in parenthesis, but keep the queries general.
 
... ... Solution to [%D %n (%T)](#problem:ComputerSelectBis)
4543 4573
4544 4574 ~ ~
4545 4575
4576 ```{.sqlmysql .numberLines include=code/sql/HW_ComputerVariation.sql snippet=solution}
4546 4577 ``` ```
4547 SELECT Model FROM COMPUTER WHERE ID = 'A';
4548 SELECT Type FROM PERIPHERAL WHERE ID = '14';
4549 SELECT Model FROM PERIPHERAL WHERE Type = 'printer';
4550 SELECT Model FROM PERIPHERAL WHERE Model LIKE 'IBM%';
4551 SELECT Model FROM PERIPHERAL, CONNEXION WHERE Computer = 'A' AND Peripheral = PERIPHERAL.ID;
4552 SELECT COUNT(Computer) FROM CONNEXION, COMPUTER WHERE Model = 'Apple IIc Plus' AND Computer = COMPUTER.ID;
4578
4579 ---
4580
4581 Solution to [%D %n (%T)](#problem:SocialMedia)
4582 ~
4583
4584 ```{.sqlmysql .numberLines include=code/sql/HW_SocialMedia.sql snippet=solution}
4553 4585 ``` ```
4554 4586
4587
4555 4588 --- ---
4556 4589
4557 4590 Solution to [%D %n (%T)](#problem:roleplaying) Solution to [%D %n (%T)](#problem:roleplaying)
 
... ... Problem (ER diagram for job and offers) +.#job-offers
6626 6659
6627 6660 --- ---
6628 6661
6662 Problem (Incorrect ER diagram) +.#incorrect-er
6663 ~
6664
6665 A company wants to develop a database to keep track of the programmers, projects and programming languages they know of.
6666 They are not willing to store guidelines for the sake of it, but believe that if a project requires a particular guideline (like, which IDE to use, what spacing convention they use, etc.), it should be stored somewhere.
6667 They want to accommodate the fact that a project can use multiple programming languages (and sometimes even multiple versions of the same language), and keep track of which programmer is leading which project.
6668 To ease "match making", they also want to track which programmer is knowledgeable of what programming language.
6669 They would also like to store links to the specifications of programming languages, as well as urls of the projects and their guidelines.
6670
6671 They came up with the following ER diagram:
6672
6673 ![](fig/er/incorrect)
6674 \
6675
6676
6677 This diagram, to your expert eyes, has multiple flaws, missing constraints, and has some inconsistencies with their requirements.
6678 List as many as you can, and suggest improvments or solution when you can think of one.
6679
6680
6681 ---
6682
6629 6683 Problem (Reverse engineering by hand) +.#Reverse-Engineering-ACTOR Problem (Reverse engineering by hand) +.#Reverse-Engineering-ACTOR
6630 6684 ~ ~
6631 6685
 
... ... Problem (From business statement to dependencies, ROUTE) +.#route
6872 6926 A tuple in the ROUTE relation contains information about a public transportation route: its name (e.g. "Gold", "Green", …), its direction (e.g., "Medical Campus", "GCC", …), the fare zone where the route operates (e.g., "Zone 1", "Zone 2", …), the price of a ticket, the nature of the vehicles assuring the route (e.g., "subway", "bus", …) and the time of operations (e.g., "24 hours a day", "from 0600 to 2200", etc.). A tuple in the ROUTE relation contains information about a public transportation route: its name (e.g. "Gold", "Green", …), its direction (e.g., "Medical Campus", "GCC", …), the fare zone where the route operates (e.g., "Zone 1", "Zone 2", …), the price of a ticket, the nature of the vehicles assuring the route (e.g., "subway", "bus", …) and the time of operations (e.g., "24 hours a day", "from 0600 to 2200", etc.).
6873 6927
6874 6928 #. Write each of the following business statement as a functional dependency: #. Write each of the following business statement as a functional dependency:
6875 #. Two different types of vehicle can not operate on routes with the same name.
6929 #. Two different types of vehicle can not operate on routes with the same name.
6876 6930 #. The ticket price depends of the fare zone and the type of vehicule. #. The ticket price depends of the fare zone and the type of vehicule.
6877 6931 #. Both the name and the direction are needed to determine the hours of operations. #. Both the name and the direction are needed to determine the hours of operations.
6878 6932 #. Two routes with the same name and the same direction must have the same fare zone. #. Two routes with the same name and the same direction must have the same fare zone.
 
... ... Problem (Normal form of the BOOK relation) +.#book
6940 6994
6941 6995 --- ---
6942 6996
6997 Problem (Normal form of the DELIVERY relation) +.#NormalizeDelivery
6998 ~
6999
7000 Consider the following relation for deliveries:
7001
7002 DELIVERY(Shipment, PackageNumber, RecipientName, Weight, DriverName, DriverPhone, RecipientPhone)
7003
7004 Suppose we have the following functional dependencies:
7005
7006 | | |
7007 ---: | :---: | --- |
7008 Shipment | → | DriverName
7009 PackageNumber | → | Shipment
7010 PackageNumber | → | \{RecipientName, RecipientPhone\}
7011 PackageNumber | → | Weight
7012 DriverName | → | DriverPhone
7013
7014 Answer the following three questions:
7015
7016 #. Reply Yes / No to the following: In this model…
7017 #. … can the shipment being handled by two drivers?
7018 #. … can a package have two different recipient?
7019 #. … can a package being in different shipments?
7020 #. … can a recipient have two different phone numbers for the same name?
7021 #. … can a driver have two different phone numbers for the same name?
7022 #. Find a primary key for this relation.
7023 #. Normalize this relation to the third normal form.
7024
7025 ---
7026
6943 7027 Problem (Normal form of the CONTACT relation) +.#NormalizeContact Problem (Normal form of the CONTACT relation) +.#NormalizeContact
6944 7028 ~ ~
6945 7029
 
... ... Solution to [%D %n (%T)](#problem:job-offers)
7178 7262
7179 7263 --- ---
7180 7264
7265 Solution to [%D %n (%T)](#problem:incorrect-er)
7266 ~
7267
7268 Among the numerous flaws, come to mind:
7269
7270 #. "Technical errors" (making the diagram incorrect):
7271 #. Multiple keys for an entity ("PROGRAMMER"),
7272 #. Absence of a key ("PROGRAMMING\_LANGUAGE"),
7273 #. Absence of the total participation constraint between the weak entity and its identifying relationship ("GUIDELINES" and "RECOMMENDED\_BY"),
7274 #. Absence of an arity (between the "USES" relationship and the "PROJECT" entity),
7275 #. To a certain extent, inconsistent naming (spaces / underscore, absence of capital letter for "leader" or "url")
7276 #. Violations of the business statement:
7277 #. "They want to accommodate the fact that a project can use multiple programming languages (and sometimes even multiple versions of the same language)": this is not possible. There are two ways of adding this feature:
7278 #. Make the "PROGRAMMING\_LANGUAGE" entity become a "VERSION\_OF\_PROGRAMMING\_LANGUAGE" entity, and make the "USE" relationship M:N.
7279 #. Leave the "PROGRAMMING\_LANGUAGE" entity as it is, make the "USE" relationship M:N, and add a "Version" attribute to it.
7280 The first option being a bit more elegant, to some extend (but we lose the capacity of deriving the latest version).
7281 #. "keep track of which programmer is leading which project.": As a leader is supposed to be a programmer as well, there should be a "IS\_THE\_LEADER\_OF" relationship between "PROGRAMMER" and "PROJECT", instead of an attribute on the "PROJECT" entity.
7282 #. "they also want to track which programmer is knowledgeable of what programming language": the "KNOWS" relationship should not be "M:1", as a programmer can probably being knowledgeable in more than one programming language.
7283 #. "if a project requires a particular guideline[…], it should be stored somewhere": The "RECOMMENDED\_BY" relationship should be 1:1.
7284 #. Basic understanding errors:
7285 #. The lack of "Name" attribute in the "PROGRAMMING\_LANGUAGE" entity is puzzling.
7286 #. "CONTRIBUTES\_TO" should probably not being total on any side, as you may want to record programmers even if they are not contributing to any project, and project even if nobody is actively working on them. Also, it should not be 1:1, but M:N.
7287 #. "RECOMMENDED\_BY" could probably be renamed "GUIDE\_THE\_DEVELOPMENT\_OF", for added clarity.
7288
7289
7290 ---
7291
7181 7292 Solution to [%D %n (%T)](#problem:ERtoRELBike) Solution to [%D %n (%T)](#problem:ERtoRELBike)
7182 7293 ~ ~
7183 7294
 
... ... Solution to [%D %n (%T)](#problem:book)
7367 7478
7368 7479 --- ---
7369 7480
7481 Solution to [%D %n (%T)](#problem:NormalizeDelivery)
7482 ~
7483
7484 #. Reply Yes / No to the following: In this model…
7485 #. … can the shipment being handled by two drivers? **No**
7486 #. … can a package have two different recipient? **No**
7487 #. … can a package being in different shipments? **No**
7488 #. … can a recipient have two different phone numbers for the same name? **Yes**
7489 #. … can a driver have two different phone numbers for the same name? **No**
7490 #. PackageNumber would be a suitable primary key for this relation.
7491 #. A possible third normal form is (where the only functional dependencies are the one given by the primary keys):
7492 SHIPMENT(S͟h͟i͟p͟m͟e͟n͟t͟, DriverName)
7493 DRIVER(D͟r͟i͟v͟e͟r͟N͟a͟m͟e͟, DriverPhone)
7494 PACKAGE(P͟a͟c͟k͟a͟g͟e͟N͟u͟m͟b͟e͟r͟, Shipment, Weight, RecipientName, RecipientNumber)
7495
7496 ---
7497
7370 7498 Solution to [%D %n (%T)](#problem:print) Solution to [%D %n (%T)](#problem:print)
7371 7499 ~ ~
7372 7500
 
... ... Problem (ER Diagram from XML File -- Award) +.#xmltoeraward
9116 9244
9117 9245 ## Solutions to Selected Problems {-} ## Solutions to Selected Problems {-}
9118 9246
9247 <!--
9248
9249 Solution to [%D %n (%T)](#problem:explainNosql)
9250 ~
9251
9252 #.
9253
9254 #.
9255
9256 #.
9257
9258 ---
9259
9260 -->
9261
9262
9119 9263 Solution to [%D %n (%T)](#problem:xmltoercustomer) Solution to [%D %n (%T)](#problem:xmltoercustomer)
9120 9264 ~ ~
9121 9265
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/caubert/CSCI_3410

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/caubert/CSCI_3410

Clone this repository using git:
git clone git://git.rocketgit.com/user/caubert/CSCI_3410

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main