File notes/00_sum.md changed (mode: 100644) (index f64e5b3..9c11bc0) |
... |
... |
institute: Augusta University |
10 |
10 |
dir: ltr |
dir: ltr |
11 |
11 |
lang: en |
lang: en |
12 |
12 |
numbersections: true |
numbersections: true |
|
13 |
|
mainfont: Linux Libertine O |
13 |
14 |
keywords: |
keywords: |
14 |
15 |
- Computer Science |
- Computer Science |
15 |
16 |
- Database |
- Database |
16 |
17 |
- MySQL programming |
- MySQL programming |
17 |
18 |
header-includes: |
header-includes: |
18 |
|
- \usepackage[table]{xcolor} |
|
19 |
|
- \setromanfont[Ligatures={Common,TeX}]{Linux Libertine O} |
|
20 |
|
- \setmainfont[Ligatures={Common,TeX}]{Linux Libertine O} |
|
21 |
|
- \setmonofont{Latin Modern Mono Light} |
|
22 |
|
- \setmonofont[SmallCapsFont={Latin Modern Mono Caps}]{Latin Modern Mono Light} |
|
23 |
|
- \usepackage{xunicode} |
|
24 |
|
- \usepackage{fvextra} |
|
25 |
|
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}} |
|
26 |
|
- \definecolor{lgray}{HTML}{e6e7e8} |
|
27 |
19 |
- \usepackage{latex/packages} |
- \usepackage{latex/packages} |
28 |
|
- \colorlet{lightgray}{gray!20} |
|
29 |
20 |
--- |
--- |
30 |
21 |
|
|
31 |
22 |
<!-- |
<!-- |
|
... |
... |
pandoc 00_sum.md --pdf-engine=xelatex --toc --filter pandoc-citeproc --top-level |
33 |
24 |
--> |
--> |
34 |
25 |
|
|
35 |
26 |
|
|
36 |
|
References are listed at the very end of this document, [here](#references). |
|
|
27 |
|
References are listed at the very end of this document, [here](#ref). |
|
28 |
|
|
37 |
29 |
We will be using, as a textbook, [@Textbook6; @Textbook7], you can take one edition or the other. |
We will be using, as a textbook, [@Textbook6; @Textbook7], you can take one edition or the other. |
38 |
30 |
|
|
39 |
31 |
A |
A |
|
... |
... |
The syllabus is at <http://spots.augusta.edu/caubert/db/>. |
46 |
38 |
|
|
47 |
39 |
All section starts with a list of ressources and ends with exercises, solution to the exercises, and problems. |
All section starts with a list of ressources and ends with exercises, solution to the exercises, and problems. |
48 |
40 |
|
|
|
41 |
|
## TODO |
|
42 |
|
|
|
43 |
|
- Color support? |
|
44 |
|
- List drawing and sort them, then add drawing in Latex, find a way for a separate compilation. |
|
45 |
|
- Make separation of lecture in another way. |
|
46 |
|
- Add example environment? |
|
47 |
|
- Add title to problem, and solve their naming / referencing issue. |
|
48 |
|
|
|
49 |
|
|
49 |
50 |
|
|
50 |
51 |
# Introduction |
# Introduction |
51 |
52 |
|
|
|
... |
... |
UPDATE ADDRESS SET Habitants = 3 WHERE Number = 120; |
2166 |
2167 |
~~~ |
~~~ |
2167 |
2168 |
|
|
2168 |
2169 |
|
|
2169 |
|
### Repetiting Tuples in MySQL {#repetition} |
|
|
2170 |
|
### Repetiting Tuples in MySQL |
|
2171 |
|
|
|
2172 |
|
Problem +.#repetition |
2170 |
2173 |
|
|
2171 |
2174 |
Log in as `testuser` and create a database `HW_2Q4`. Tell MySQL that you want to use that database, and create a table (I will assume you named it `EXAMPLE` in the following, but you are free to name it the way you want) with at least two attributes that have different data types. Don't declare a primary key yet. Answer the following: |
Log in as `testuser` and create a database `HW_2Q4`. Tell MySQL that you want to use that database, and create a table (I will assume you named it `EXAMPLE` in the following, but you are free to name it the way you want) with at least two attributes that have different data types. Don't declare a primary key yet. Answer the following: |
2172 |
2175 |
|
|
|
... |
... |
Log in as `testuser` and create a database `HW_2Q4`. Tell MySQL that you want to |
2207 |
2210 |
|
|
2208 |
2211 |
### Prof Revisited |
### Prof Revisited |
2209 |
2212 |
|
|
|
2213 |
|
Problem +.#profrevisited |
|
2214 |
|
|
2210 |
2215 |
Create the `PROF`, `STUDENT`, `DEPARTMENT` and `GRADE` tables as during the lecture. |
Create the `PROF`, `STUDENT`, `DEPARTMENT` and `GRADE` tables as during the lecture. |
2211 |
2216 |
Populate them with some data. |
Populate them with some data. |
2212 |
2217 |
|
|
|
... |
... |
ALTER TABLE EXAMPLE ADD PRIMARY KEY (X); |
2446 |
2451 |
ERROR 1062 (23000): Duplicate entry 'Train' for key 'PRIMARY' |
ERROR 1062 (23000): Duplicate entry 'Train' for key 'PRIMARY' |
2447 |
2452 |
~~~ |
~~~ |
2448 |
2453 |
|
|
2449 |
|
### Solution For Prof Revisited |
|
|
2454 |
|
### Solution For @problem:profrevisited |
2450 |
2455 |
|
|
2451 |
|
%Solution +.# |
|
2452 |
2456 |
|
|
2453 |
2457 |
~~~{.sqlmysql} |
~~~{.sqlmysql} |
2454 |
2458 |
CREATE TABLE LECTURE( |
CREATE TABLE LECTURE( |
|
... |
... |
OR |
3715 |
3719 |
\draw (car) edge[total] node[above, sloped]{$N$} (accident); |
\draw (car) edge[total] node[above, sloped]{$N$} (accident); |
3716 |
3720 |
\end{tikzpicture} |
\end{tikzpicture} |
3717 |
3721 |
|
|
3718 |
|
Problem +.# |
|
|
3722 |
|
Problem +.#ERtoREL |
3719 |
3723 |
|
|
3720 |
3724 |
Apply the ER-to-Relation mapping to your ER diagram from the previous problem. |
Apply the ER-to-Relation mapping to your ER diagram from the previous problem. |
3721 |
3725 |
|
|
|
... |
... |
Normalize the "FLIGHT" relation to its third normal form. |
3799 |
3803 |
You can indicate your steps, justify your reasoning, and indicate the foreign keys if you want to, but don't have to. |
You can indicate your steps, justify your reasoning, and indicate the foreign keys if you want to, but don't have to. |
3800 |
3804 |
|
|
3801 |
3805 |
|
|
3802 |
|
|
|
3803 |
|
Problem +.#Bike |
|
|
3806 |
|
Problem +.#bike |
3804 |
3807 |
|
|
3805 |
3808 |
This problem asks you to convert business statements into dependencies. |
This problem asks you to convert business statements into dependencies. |
3806 |
3809 |
Consider the following relation: |
Consider the following relation: |
|
... |
... |
Author\_name | → | Author\_affil |
3864 |
3867 |
|
|
3865 |
3868 |
|
|
3866 |
3869 |
Problem +.# |
Problem +.# |
3867 |
|
Consider the following requirements for a UNIVERSITY database, used to keep track of students' transcripts. |
|
|
3870 |
|
~ Consider the following requirements for a UNIVERSITY database, used to keep track of students' transcripts. |
3868 |
3871 |
|
|
3869 |
3872 |
#. The university keeps track of each student's name, student number, class (freshman, sophomore, …, graduate), major department, minor department (if any), and degree program (B.A., B.S., …, Ph.D.). |
#. The university keeps track of each student's name, student number, class (freshman, sophomore, …, graduate), major department, minor department (if any), and degree program (B.A., B.S., …, Ph.D.). |
3870 |
3873 |
Student number has unique values for each student. |
Student number has unique values for each student. |
|
... |
... |
Note that a car can have at most one driver, \(N\) passengers, \(N\) insurances, |
4028 |
4031 |
3. Convert the E.-R. diagram to a U.M.L. class diagram. Comparing Figure 7.16 with Figure 7.2 from your textbook should guide you. |
3. Convert the E.-R. diagram to a U.M.L. class diagram. Comparing Figure 7.16 with Figure 7.2 from your textbook should guide you. |
4029 |
4032 |
|
|
4030 |
4033 |
|
|
4031 |
|
Problem +.#MYSQLW |
|
|
4034 |
|
Problem +.#mysqlw |
4032 |
4035 |
|
|
4033 |
4036 |
In this exercise, we will install and explore the basic functionalities of MySQL Workbench, which is a cross-platform, open-source, and free graphical interface for database design. |
In this exercise, we will install and explore the basic functionalities of MySQL Workbench, which is a cross-platform, open-source, and free graphical interface for database design. |
4034 |
4037 |
|
|
|
... |
... |
In this exercise, we will install and explore the basic functionalities of MySQL |
4044 |
4047 |
|
|
4045 |
4048 |
Problem +.#ReverseEng |
Problem +.#ReverseEng |
4046 |
4049 |
|
|
4047 |
|
*This problem requires you to have successfully completed @probleme:MYSQLW and @problem:ERtoREL.* |
|
|
4050 |
|
*This problem requires you to have successfully completed @problem:mysqlw and @problem:ERtoREL.* |
4048 |
4051 |
|
|
4049 |
|
Using the relational database schema you obtained in question~\ref{ERtoREL} of @problem:ERtoREL, write the `SQL` implementation of that database. |
|
|
4052 |
|
Using the relational database schema you obtained in @problem:ERtoREL, write the `SQL` implementation of that database. |
4050 |
4053 |
Then, using MySQL Workbench, use the "Reverse Engineering" function to obtain a E.E.R. diagram of your database, and compare it with the U.M.L. diagram you draw in question~ \ref{ERtoUML} of @problem:ERtoREL. |
Then, using MySQL Workbench, use the "Reverse Engineering" function to obtain a E.E.R. diagram of your database, and compare it with the U.M.L. diagram you draw in question~ \ref{ERtoUML} of @problem:ERtoREL. |
4051 |
4054 |
Apart from the difference inherent to the nature of the diagram (i.e., U.M.L. Vs E.E.R.), how are they the same? How do they differ? Is the automated tool as efficient and accurate as you are? |
Apart from the difference inherent to the nature of the diagram (i.e., U.M.L. Vs E.E.R.), how are they the same? How do they differ? Is the automated tool as efficient and accurate as you are? |
4052 |
4055 |
|
|
|
... |
... |
We can normalize it as |
4200 |
4203 |
- Because of \{Book title\} → \{ Book\_type\} → \{ List\_price\}\\ |
- Because of \{Book title\} → \{ Book\_type\} → \{ List\_price\}\\ |
4201 |
4204 |
(Book Title, Publisher, Book Type) and (Book Type, List Price), (Author Name, Author Affiliation), (Author Name, Book Title). |
(Book Title, Publisher, Book Type) and (Book Type, List Price), (Author Name, Author Affiliation), (Author Name, Book Title). |
4202 |
4205 |
|
|
4203 |
|
Solution for @probleme:MYSQLW |
|
|
4206 |
|
Solution for @problem:mysqlw |
4204 |
4207 |
~ For "Car", we need to create an attribute, like "vin". |
~ For "Car", we need to create an attribute, like "vin". |
4205 |
4208 |
For "Car Insurance", "Policy Number" is perfect. |
For "Car Insurance", "Policy Number" is perfect. |
4206 |
4209 |
|
|
|
... |
... |
On top of the [references](references), were useful in the writing of those note |
5369 |
5372 |
- <https://www.ntu.edu.sg/home/ehchua/programming/java/JDBC_Basic.html> |
- <https://www.ntu.edu.sg/home/ehchua/programming/java/JDBC_Basic.html> |
5370 |
5373 |
|
|
5371 |
5374 |
|
|
5372 |
|
# References {#references} |
|
|
5375 |
|
# References {#ref} |