List of commits:
Subject Hash Author Date (UTC)
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
Small edit, correcting maefile. 7baa188be7d322e5288b498afbb7beaa96a9770b aubert@math.cnrs.fr 2020-04-19 07:36:08
Cleaned latex files. 79b68f7b709ddeebc8133f7962fe5aabb3376304 aubert@math.cnrs.fr 2020-04-19 06:22:30
Minor corrections in installation manual. 436cee8616c25ccbed8bc406d988c2b4d28420f8 aubert@math.cnrs.fr 2020-04-19 06:19:04
Minor corrections in installation manual. cb8cdfbd506a1344c81aecda055165cc1ca54ece aubert@math.cnrs.fr 2020-04-19 06:17:52
Working on install manual. 3702c6437ee163eb4a61b4d69cffee8c8a76dc3d aubert@math.cnrs.fr 2020-04-19 06:04:22
Worked on makefiles and example file. 4255d5e85bb684349f7f7798455dd8b3a273254b aubert@math.cnrs.fr 2020-04-19 04:56:53
Re-idented some of the code. 124375e6bed1edb96d1bb4bcec8f111c8a3a1197 aubert@math.cnrs.fr 2020-04-19 03:10:02
Java indentation 2b317a12b7ab52bdca576a1bb46b2a2ce295464f guest 2020-04-18 22:21:04
test 6fefa044794ff1d74a3d2493556c836b3dd97e74 guest 2020-04-18 22:18:44
Commit d927955c1269ff1b110057577e50705fd41f4e2d - Minor edits on narrative.
Author: aubert@math.cnrs.fr
Author date (UTC): 2020-04-22 05:07
Committer name: aubert@math.cnrs.fr
Committer date (UTC): 2020-04-22 05:07
Parent(s): a2d3350fbbd91d86393ab495469c5bc694490398
Signer:
Signing key:
Signing status: N
Tree: 8e57fa39a4e25ced47e7d999921d5630d328eb45
File Lines added Lines deleted
notes/code/sql/HW_Lecture.sql 0 88
notes/code/sql/HW_ProfExampleRevisitedRevisited.sql 147 0
notes/lectures_notes.md 56 7
File notes/code/sql/HW_Lecture.sql deleted (index 79368f9..0000000)
1 /* code/sql/HW_Lecture.sql */
2
3 CREATE TABLE HW_Lecture(
4 Name VARCHAR(25),
5 Instructor VARCHAR(25),
6 Year YEAR(4),
7 Code CHAR(5),
8 PRIMARY KEY(Year, Code),
9 FOREIGN KEY (Instructor) REFERENCES PROF(Login)
10 );
11
12 INSERT INTO HW_Lecture VALUES
13 ('Intro to CS', 'caubert', 2017, '1304'),
14 ('Intro to Algebra', 'perdos', 2017, '1405'),
15 ('Intro to Cyber', 'aturing', 2017, '1234');
16
17 /*
18 This representation can not handle the following situations:
19 - If multiple instructors teach the same class,
20 - If the HW_Lecture is taught more than once a year (either because it is taught in the Fall, Spring and Summer, or if multiple sections are offered at the same time),
21 - If a HW_Lecture is cross-listed, then some duplication of information will be needed.
22 */
23
24 ALTER TABLE GRADE
25 ADD COLUMN LectureCode CHAR(5),
26 ADD COLUMN LectureYear YEAR(4);
27
28 DESCRIBE GRADE;
29
30 SELECT * FROM GRADE;
31
32 ALTER TABLE GRADE
33 ADD FOREIGN KEY (LectureYear, LectureCode)
34 REFERENCES HW_Lecture(Year, Code);
35
36
37 UPDATE GRADE SET LectureCode = '1304', LectureYear = 2017
38 WHERE Login = 'jrakesh'
39 AND Grade = '2.85';
40
41 UPDATE GRADE SET LectureCode = '1405', LectureYear = 2017
42 WHERE Login = 'svlatka'
43 OR (Login = 'jrakesh' AND Grade = '3.85');
44
45 UPDATE GRADE SET LectureCode = '1234', LectureYear = 2017
46 WHERE Login = 'aalyx'
47 OR Login = 'cjoella';
48
49 SELECT Login, Grade
50 FROM GRADE
51 WHERE Lecturecode='1304'
52 AND LectureYear = '2017';
53
54 SELECT DISTINCT Instructor
55 FROM HW_Lecture
56 WHERE Year = 2017;
57
58 SELECT Name, Grade
59 FROM STUDENT, GRADE
60 WHERE GRADE.LectureCode = 1405
61 AND STUDENT.Login = GRADE.Login;
62
63 SELECT Year
64 FROM HW_Lecture
65 WHERE Code = '1234';
66
67 SELECT Name
68 FROM HW_Lecture
69 WHERE Year IN
70 (SELECT Year
71 FROM HW_Lecture
72 WHERE CODE = '1234');
73
74 SELECT B.name
75 FROM STUDENT AS A, STUDENT AS B
76 WHERE A.Name = 'Ava Alyx'
77 AND A.Registered > B.Registered;
78
79 SELECT COUNT(DISTINCT PROF.Name) AS 'Head Teaching This Year'
80 FROM HW_Lecture, DEPARTMENT, PROF
81 WHERE Year = 2017
82 AND Instructor = Head
83 AND Head = PROF.Login;
File notes/code/sql/HW_ProfExampleRevisitedRevisited.sql added (mode: 100644) (index 0000000..884f9cd)
1 -- start snippet recreate
2 /* code/sql/HW_ProfExampleRevisitedRevisited.sql */
3
4 DROP SCHEMA IF EXISTS HW_ProfExampleRevisited;
5 CREATE SCHEMA HW_ProfExampleRevisited;
6 USE HW_ProfExampleRevisited;
7
8 CREATE TABLE PROF(
9 Login VARCHAR(25) PRIMARY KEY,
10 Name VARCHAR(25),
11 Department CHAR(5)
12 );
13
14 CREATE TABLE DEPARTMENT(
15 Code CHAR(5) PRIMARY KEY,
16 Name VARCHAR(25),
17 Head VARCHAR(25),
18 FOREIGN KEY (Head) REFERENCES PROF(Login)
19 ON UPDATE CASCADE
20 );
21
22 ALTER TABLE PROF ADD FOREIGN KEY (Department)
23 REFERENCES DEPARTMENT(Code);
24
25 CREATE TABLE STUDENT(
26 Login VARCHAR(25) PRIMARY KEY,
27 Name VARCHAR(25),
28 Registered DATE,
29 Major CHAR(5),
30 FOREIGN KEY (Major) REFERENCES DEPARTMENT(Code)
31 );
32
33 CREATE TABLE GRADE(
34 Login VARCHAR(25),
35 Grade INT,
36 PRIMARY KEY(Login, Grade),
37 FOREIGN KEY (Login) REFERENCES STUDENT(Login)
38 );
39
40 INSERT INTO DEPARTMENT VALUES
41 ('MATH', 'Mathematics', NULL),
42 ('CS', 'Computer Science', NULL);
43
44 INSERT INTO DEPARTMENT (Code, Name) VALUES
45 ('CYBR', 'Cyber Secturity');
46
47 INSERT INTO PROF (Login, Department, Name) VALUES
48 ('caubert', 'CS', 'Clément Aubert');
49
50 INSERT INTO PROF (Login, Name, Department) VALUES
51 ('aturing', 'Alan Turing', 'CS'),
52 ('perdos', 'Paul Erdős', 'MATH'),
53 ('bgates', 'Bill Gates', 'CYBR');
54
55 INSERT INTO STUDENT (Login, Name, Registered, Major) VALUES
56 ('jrakesh', 'Jalal Rakesh', DATE'2017-12-01', 'CS'),
57 ('svlatka', 'Sacnite Vlatka', '2015-03-12', 'MATH'),
58 ('cjoella', 'Candice Joella', '20120212', 'CYBR'),
59 ('aalyx', 'Ava Alyx', 20121011, 'CYBR'),
60 ('caubert', 'Clément Aubert', NULL, 'CYBR');
61
62 INSERT INTO GRADE VALUES
63 ('jrakesh', 3.8),
64 ('svlatka', 2.5);
65 -- end snippet recreate
66
67 -- start snippet lecture
68 CREATE TABLE HW_Lecture(
69 Name VARCHAR(25),
70 Instructor VARCHAR(25),
71 Year YEAR(4),
72 Code CHAR(5),
73 PRIMARY KEY(Year, Code),
74 FOREIGN KEY (Instructor) REFERENCES PROF(Login)
75 );
76
77 INSERT INTO HW_Lecture VALUES
78 ('Intro to CS', 'caubert', 2017, '1304'),
79 ('Intro to Algebra', 'perdos', 2017, '1405'),
80 ('Intro to Cyber', 'aturing', 2017, '1234');
81 -- end snippet lecture
82
83 ALTER TABLE GRADE
84 ADD COLUMN LectureCode CHAR(5),
85 ADD COLUMN LectureYear YEAR(4);
86
87 ALTER TABLE GRADE
88 ADD FOREIGN KEY (LectureYear, LectureCode)
89 REFERENCES HW_Lecture(Year, Code);
90
91 -- start snippet grade
92 DESCRIBE GRADE;
93
94 SELECT * FROM GRADE;
95 -- end snippet grade
96
97 -- start snippet update
98 UPDATE GRADE SET LectureCode = '1304', LectureYear = 2017
99 WHERE Login = 'jrakesh'
100 AND Grade = '2.85';
101
102 UPDATE GRADE SET LectureCode = '1405', LectureYear = 2017
103 WHERE Login = 'svlatka'
104 OR (Login = 'jrakesh' AND Grade = '3.85');
105
106 UPDATE GRADE SET LectureCode = '1234', LectureYear = 2017
107 WHERE Login = 'aalyx'
108 OR Login = 'cjoella';
109 -- end snippet update
110
111 -- start snippet select
112 SELECT Login, Grade
113 FROM GRADE
114 WHERE Lecturecode='1304'
115 AND LectureYear = '2017';
116
117 SELECT DISTINCT Instructor
118 FROM HW_Lecture
119 WHERE Year = 2017;
120
121 SELECT Name, Grade
122 FROM STUDENT, GRADE
123 WHERE GRADE.LectureCode = 1405
124 AND STUDENT.Login = GRADE.Login;
125
126 SELECT Year
127 FROM HW_Lecture
128 WHERE Code = '1234';
129
130 SELECT Name
131 FROM HW_Lecture
132 WHERE Year IN
133 (SELECT Year
134 FROM HW_Lecture
135 WHERE CODE = '1234');
136
137 SELECT B.name
138 FROM STUDENT AS A, STUDENT AS B
139 WHERE A.Name = 'Ava Alyx'
140 AND A.Registered > B.Registered;
141
142 SELECT COUNT(DISTINCT PROF.Name) AS 'Head Teaching This Year'
143 FROM HW_Lecture, DEPARTMENT, PROF
144 WHERE Year = 2017
145 AND Instructor = Head
146 AND Head = PROF.Login;
147 -- end snippet select
File notes/lectures_notes.md changed (mode: 100644) (index e67ec79..5b1eb9c)
... ... Finally, the comments `-- start snippet something` and `-- end snippet something
66 66 <!--: the colors and the ↪ `↪` ↪ ${\tiny\hookrightarrow}$, \tiny\ensuremath{\hookrightarrow} symbols are here to ease the reading, but you can ignore them safely.--> <!--: the colors and the ↪ `↪` ↪ ${\tiny\hookrightarrow}$, \tiny\ensuremath{\hookrightarrow} symbols are here to ease the reading, but you can ignore them safely.-->
67 67
68 68 To clone this source of those notes and have a local copy of it, please refer to the instructions at <http://spots.augusta.edu/caubert/db/ln/README.html>. To clone this source of those notes and have a local copy of it, please refer to the instructions at <http://spots.augusta.edu/caubert/db/ln/README.html>.
69 Instructions on how to compile those notes are available at the same place.
69 Instructions on how to compile those notes and how to contribute are linked from this document.
70 70
71 71 <!-- <!--
72 72 To clone and compile this document, refer to the `README.md` file, at <https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/blob/README.md> or <http://spots.augusta.edu/caubert/db/ln/README.html>. To clone and compile this document, refer to the `README.md` file, at <https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/blob/README.md> or <http://spots.augusta.edu/caubert/db/ln/README.html>.
 
... ... Problem (Revisiting the PROF table) +.#profrevisited
3519 3519
3520 3520 Create the `PROF`, `DEPARTMENT`, `STUDENT` and `GRADE` tables as in the ["Constructing and populating a new example"](#sec:profexample) section. Create the `PROF`, `DEPARTMENT`, `STUDENT` and `GRADE` tables as in the ["Constructing and populating a new example"](#sec:profexample) section.
3521 3521 Populate them with some data (copy it from the notes or come up with your own data). Populate them with some data (copy it from the notes or come up with your own data).
3522
3523 To obtain exactly the same schema as the one we developped and edited, you can use mysqldump to "dump" this table, with a command like
3524
3525 ```{.bash}
3526 mysqldump -u testuser -ppassword\
3527 -h localhost --add-drop-database\
3528 --skip-comments --compact\
3529 HW_ProfExample > dump.sql
3530 ```
3531
3532 The code we studied during the lecture is more or less the following.
3533
3534 ```{.sqlmysql .numberLines include=code/sql/HW_ProfExampleRevisitedRevisited.sql snippet=recreate}
3535 ```
3536
3537 We will resume working on this model, and enhance it.
3522 3538
3523 3539 @problem:profrevisited -- Question -.# @problem:profrevisited -- Question -.#
3524 3540
 
... ... Solution to [%D %n (%T)](#problem:profrevisited)
4437 4453 @problem:profrevisited-- Solution to Q. -.# @problem:profrevisited-- Solution to Q. -.#
4438 4454 ~ ~
4439 4455
4456 The code is straightforward:
4457
4458 ```{.sqlmysql .numberLines include=code/sql/HW_ProfExampleRevisitedRevisited.sql snippet=lecture}
4459 ```
4460 However, this representation can not handle the following situations:
4461
4462 - If multiple instructors teach the same class,
4463 - If the HW_Lecture is taught more than once a year (either because it is taught in the Fall, Spring and Summer, or if multiple sections are offered at the same time),
4464 - If a Lecture is cross-listed, then some duplication of information will be needed.
4465
4466 @problem:profrevisited-- Solution to Q. -.#
4467 ~
4468
4469 The statements are immediate:
4440 4470
4441 For the other questions, refer to this code.
4471 ```{.sqlmysql .numberLines include=code/sql/HW_ProfExampleRevisitedRevisited.sql snippet=grade}
4472 ```
4473
4474 What may be surprising is that the values for `LectureCode` and `LectureYear` are set to `NULL` in all the tuples.
4475
4476 @problem:profrevisited-- Solution to Q. -.#
4477 ~
4478
4479 We use `UPDATE` statements:
4480
4481 ```{.sqlmysql .numberLines include=code/sql/HW_ProfExampleRevisitedRevisited.sql snippet=update}
4482 ```
4442 4483
4443 ```{.sqlmysql .numberLines include=code/sql/HW_Lecture.sql}
4444 ```
4484 @problem:profrevisited-- Solution to Q. -.#
4485 ~
4486 We refer back to the solution to Q. 1.
4487
4488 @problem:profrevisited-- Solution to Q. -.#
4489 ~
4445 4490
4491 We use `SELECT` statements:
4492
4493 ```{.sqlmysql .numberLines include=code/sql/HW_ProfExampleRevisitedRevisited.sql snippet=select}
4494 ```
4446 4495 --- ---
4447 4496
4448 4497 Solution to [%D %n (%T)](#problem:train) Solution to [%D %n (%T)](#problem:train)
 
... ... Problem (Using MySQL Workbench's reverse engineering) +.#reverseeng
7048 7097 Using the relational database schema you obtained in @problem:UMLtoRELDriver, write the `SQL` implementation of that database. Using the relational database schema you obtained in @problem:UMLtoRELDriver, write the `SQL` implementation of that database.
7049 7098 Then, using MySQL Workbench, use the "Reverse Engineering" function to obtain an EER diagram of your database and compare it with the UML diagram from @problem:UMLtoRELDriver. Then, using MySQL Workbench, use the "Reverse Engineering" function to obtain an EER diagram of your database and compare it with the UML diagram from @problem:UMLtoRELDriver.
7050 7099 Apart from the difference inherent to the nature of the diagram (i.e., UML vs EER), how else are they different? Apart from the difference inherent to the nature of the diagram (i.e., UML vs EER), how else are they different?
7051 How do they the same?
7100 How are they the same?
7052 7101 Is the automated tool as efficient and accurate as you are? Is the automated tool as efficient and accurate as you are?
7053 7102
7054 7103 --- ---
 
... ... Solution to [%D %n (%T)](#problem:reverseeng)
7441 7490 - <http://spots.augusta.edu/caubert/teaching/general/java/> - <http://spots.augusta.edu/caubert/teaching/general/java/>
7442 7491 - If you experience any trouble, <https://www.ntu.edu.sg/home/ehchua/programming/howto/ErrorMessages.html#JDBCErrors> might be a good read. - If you experience any trouble, <https://www.ntu.edu.sg/home/ehchua/programming/howto/ErrorMessages.html#JDBCErrors> might be a good read.
7443 7492 - [@Textbook6, 13.3.2] or [@Textbook7, Chapter 10] is a condensed, but good, read. - [@Textbook6, 13.3.2] or [@Textbook7, Chapter 10] is a condensed, but good, read.
7444 - Many textbooks on Java include a part on Databases, just like this one: [F@Gaddis2014, Chapter 16].
7493 - Many textbooks on Java include a part on Databases, just like this one: [@Gaddis2014, Chapter 16].
7445 7494
7446 7495 ## Overview ## Overview
7447 7496
 
... ... Solution to [%D %n (%T)](#problem:xmltoeraward)
9081 9130 Therefore, it seems more reasonnable to make the award an entity. Therefore, it seems more reasonnable to make the award an entity.
9082 9131
9083 9132 How should we connect the AWARD entity with the RESEARCHER and INSTITUTION entities? How should we connect the AWARD entity with the RESEARCHER and INSTITUTION entities?
9084 A trinary relation has some drawbacks, since it would require some duplication when multiple investigators are working on the same award.
9133 A ternary relation has some drawbacks, since it would require some duplication when multiple investigators are working on the same award.
9085 9134 Instead, having one binary relationship between the award and the institution, and one binary relationship between the award and the researcher (that specifies further the role of the researcher for that particular award), seems like a safer choice. Instead, having one binary relationship between the award and the institution, and one binary relationship between the award and the researcher (that specifies further the role of the researcher for that particular award), seems like a safer choice.
9086 9135 An award must be awarded to at least one researcher and one institution, but we do not know if there is a maximum number of institutions that can obtain the same award, so it is better not to restrict this arity. An award must be awarded to at least one researcher and one institution, but we do not know if there is a maximum number of institutions that can obtain the same award, so it is better not to restrict this arity.
9087 9136 Whether there should be a relationship between the researcher and the institution is up in the air; we do not know if a researcher has to work for an institution to get a grant, nor if getting a grant for an institution means that you work for it, so it is probably better to refrain from adding such a relationship. Whether there should be a relationship between the researcher and the institution is up in the air; we do not know if a researcher has to work for an institution to get a grant, nor if getting a grant for an institution means that you work for it, so it is probably better to refrain from adding such a relationship.
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