File CONTRIB.md changed (mode: 100644) (index eaab913..7a3883b) |
... |
... |
If you are not familiar with the open source eco-system and how you can help pro |
9 |
9 |
|
|
10 |
10 |
# About the Project {#about} |
# About the Project {#about} |
11 |
11 |
|
|
12 |
|
You can find a brief presentation of those notes [on their website](http://spots.augusta.edu/caubert/db/ln/). |
|
13 |
|
They are the main source of exercises, problems and notes for a [Database class](http://spots.augusta.edu/caubert/db/) taught at [Augusta University](https://www.augusta.edu/), and are updated every time the class is taught. |
|
|
12 |
|
You can find a brief presentation of those notes [on their website](https://spots.augusta.edu/caubert/db/ln/). |
|
13 |
|
They are the main source of exercises, problems and notes for a [Database class](https://spots.augusta.edu/caubert/db/) taught at [Augusta University](https://www.augusta.edu/), and are updated every time the class is taught. |
14 |
14 |
Improving the content of those notes by your suggestions, remarks and questions _will_ benefit students and instructors, so don't be shy! |
Improving the content of those notes by your suggestions, remarks and questions _will_ benefit students and instructors, so don't be shy! |
15 |
15 |
|
|
16 |
16 |
# What to Contribute {#what} |
# What to Contribute {#what} |
|
... |
... |
If you'd like to contribute but are not sure where to start, you can refer to [` |
26 |
26 |
|
|
27 |
27 |
You can |
You can |
28 |
28 |
|
|
29 |
|
- …contact or visit the main author, cf. <http://spots.augusta.edu/caubert/#contact>. |
|
|
29 |
|
- …contact or visit the main author, cf. <https://spots.augusta.edu/caubert/#contact>. |
30 |
30 |
- …submit bug reports at <https://rocketgit.com/user/caubert/CSCI_3410/bug> (requires an account). |
- …submit bug reports at <https://rocketgit.com/user/caubert/CSCI_3410/bug> (requires an account). |
31 |
31 |
- …submit a pull request, which is the way detailed below. |
- …submit a pull request, which is the way detailed below. |
32 |
32 |
|
|
File README.md changed (mode: 100644) (index 2a168c9..a7e490e) |
... |
... |
geometry: margin=1in |
10 |
10 |
--- |
--- |
11 |
11 |
|
|
12 |
12 |
Here are the lecture notes, codes, exercises, problems and references for a lecture on database taught at [Augusta University](https://www.augusta.edu/) by C. Aubert. |
Here are the lecture notes, codes, exercises, problems and references for a lecture on database taught at [Augusta University](https://www.augusta.edu/) by C. Aubert. |
13 |
|
The webpage for this project is at <http://spots.augusta.edu/caubert/db/ln/>, and it contains a compiled version of the notes. |
|
|
13 |
|
The webpage for this project is at <https://spots.augusta.edu/caubert/db/ln/>, and it contains a compiled version of the notes. |
14 |
14 |
|
|
15 |
15 |
# Getting Started |
# Getting Started |
16 |
16 |
|
|
|
... |
... |
The Makefile in the `notes` folder is commented. |
61 |
61 |
The simplest way to contribute is to report typos, errors or misleading statements. |
The simplest way to contribute is to report typos, errors or misleading statements. |
62 |
62 |
You will find some instructions at [`CONTRIB.md`](CONTRIB.html) if you'd like, but you can… |
You will find some instructions at [`CONTRIB.md`](CONTRIB.html) if you'd like, but you can… |
63 |
63 |
|
|
64 |
|
- …contact or visit the author, cf. <http://spots.augusta.edu/caubert/#contact>. |
|
|
64 |
|
- …contact or visit the author, cf. <https://spots.augusta.edu/caubert/#contact>. |
65 |
65 |
- …submit a pull request, cf. [`CONTRIB.md`](CONTRIB.html) for more information. |
- …submit a pull request, cf. [`CONTRIB.md`](CONTRIB.html) for more information. |
66 |
66 |
- …submit bug reports at <https://rocketgit.com/user/caubert/CSCI_3410/bug> (requires an account). |
- …submit bug reports at <https://rocketgit.com/user/caubert/CSCI_3410/bug> (requires an account). |
67 |
67 |
|
|
68 |
68 |
# Authors and Contributors |
# Authors and Contributors |
69 |
69 |
|
|
70 |
|
- **Clément Aubert** - *Initial work* - <http://spots.augusta.edu/caubert/> |
|
|
70 |
|
- **Clément Aubert** - *Initial work* - <https://spots.augusta.edu/caubert/> |
71 |
71 |
- **Crystal Anderson** - *Revisions* |
- **Crystal Anderson** - *Revisions* |
72 |
72 |
- **Bobby Mcmanus**, **Minh Nguyen** and **Poonam Veeral** - *Installation guide and quality control* |
- **Bobby Mcmanus**, **Minh Nguyen** and **Poonam Veeral** - *Installation guide and quality control* |
73 |
73 |
|
|
File notes/lectures_notes.md changed (mode: 100644) (index 3e5269b..4bae88a) |
... |
... |
Finally, the comments `-- start snippet something` and `-- end snippet something |
65 |
65 |
|
|
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 |
|
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>. |
|
|
68 |
|
To clone this source of those notes and have a local copy of it, please refer to the instructions at <https://spots.augusta.edu/caubert/db/ln/README.html>. |
69 |
69 |
Instructions on how to compile those notes and how to contribute are linked from this document. |
Instructions on how to compile those notes and how to contribute are linked from this document. |
70 |
70 |
|
|
71 |
71 |
On top of the notes, you will find in this document: |
On top of the notes, you will find in this document: |
|
... |
... |
On top of the notes, you will find in this document: |
74 |
74 |
- and for each chapter, |
- and for each chapter, |
75 |
75 |
- A list of additional resources, |
- A list of additional resources, |
76 |
76 |
- A list of short exercises, |
- A list of short exercises, |
77 |
|
- Solution to those exercises, - A list of problem, - Sometimes, solution to some of those problems. Any feedback is greatly appreciated. Please refer to <http://spots.augusta.edu/caubert/db/ln/README.html#contributing> for how to contribute to those notes. The syllabus is at <http://spots.augusta.edu/caubert/db/>, and the webpage for this notes is at <http://spots.augusta.edu/caubert/db/ln/>. Please, refer to those notes using this entry [@AubertCSCI3410-DatabaseSystems]: ```{.bibtex include=bib/entry.bib} ``` |
|
|
77 |
|
- Solution to those exercises, - A list of problem, - Sometimes, solution to some of those problems. Any feedback is greatly appreciated. Please refer to <https://spots.augusta.edu/caubert/db/ln/README.html#contributing> for how to contribute to those notes. The syllabus is at <https://spots.augusta.edu/caubert/db/>, and the webpage for this notes is at <https://spots.augusta.edu/caubert/db/ln/>. Please, refer to those notes using this entry [@AubertCSCI3410-DatabaseSystems]: |
|
78 |
|
|
|
79 |
|
```{.bibtex include=bib/entry.bib} |
|
80 |
|
``` |
|
81 |
|
|
78 |
82 |
## Planned Schedule {-} |
## Planned Schedule {-} |
79 |
83 |
|
|
80 |
84 |
A typical (meeting twice a week, ±17 weeks, ±30 classes) semester is divided as follows: |
A typical (meeting twice a week, ±17 weeks, ±30 classes) semester is divided as follows: |
81 |
85 |
|
|
82 |
|
- Lecture 1: Presentation and [Syllabus](http://spots.augusta.edu/caubert/db/) |
|
|
86 |
|
- Lecture 1: Presentation and [Syllabus](https://spots.augusta.edu/caubert/db/) |
83 |
87 |
- Lecture 2: [Introduction](#introduction) |
- Lecture 2: [Introduction](#introduction) |
84 |
88 |
- Lecture 3--5: [The Relational Model](#the-relational-model) |
- Lecture 3--5: [The Relational Model](#the-relational-model) |
85 |
89 |
- Lecture 6--9: [The SQL Programming Language](#the-sql-programming-language) |
- Lecture 6--9: [The SQL Programming Language](#the-sql-programming-language) |
|
... |
... |
Exercise +.# |
6113 |
6117 |
|
|
6114 |
6118 |
Exercise +.# |
Exercise +.# |
6115 |
6119 |
|
|
|
6120 |
|
: What would be the benefit of having a composite attribute "Phone" made of two attributes (Number and Description) being multi-valued? Answer this question, and draw the resulting attribute. |
|
6121 |
|
|
|
6122 |
|
Exercise +.# |
|
6123 |
|
|
6116 |
6124 |
: Draw the ER diagram for a "COMPUTER" entity that has one multivalued attribute "Operating\_System", a composite attribute "Devices" (decomposed into "Keyboard" and "Mouse") and an "ID" key attribute. |
: Draw the ER diagram for a "COMPUTER" entity that has one multivalued attribute "Operating\_System", a composite attribute "Devices" (decomposed into "Keyboard" and "Mouse") and an "ID" key attribute. |
6117 |
6125 |
|
|
6118 |
6126 |
Exercise +.# |
Exercise +.# |
|
... |
... |
Exercise +.# |
6148 |
6156 |
|
|
6149 |
6157 |
: What are the two possible structural constraints on a relationship type? |
: What are the two possible structural constraints on a relationship type? |
6150 |
6158 |
|
|
|
6159 |
|
Exercise +.# |
|
6160 |
|
|
|
6161 |
|
: Draw the diagram for a "VideoGame" entity that would allow to store the name of the game, the supported platform(s) and the release date. |
|
6162 |
|
Then, add a recursive relationship on that entity called "Is the sequel of" and specify all the constraints. |
|
6163 |
|
|
6151 |
6164 |
Exercise +.# |
Exercise +.# |
6152 |
6165 |
~ |
~ |
6153 |
6166 |
|
|
|
... |
... |
Exercise +.# |
6208 |
6221 |
|
|
6209 |
6222 |
Exercise +.# |
Exercise +.# |
6210 |
6223 |
|
|
|
6224 |
|
~ Consider the following diagram: |
|
6225 |
|
|
|
6226 |
|
 |
|
6227 |
|
|
|
6228 |
|
#. Express the constraints represented in the diagram in plain English. |
|
6229 |
|
#. Imagine there is a "FromIP" attribute on the "OPENED_BY" relationship that stores the IP used by the user to open the ticket. Could you migrate the attribute to one of the entity? Explain how you would do it, or why it is impossible. |
|
6230 |
|
|
|
6231 |
|
Exercise +.# |
|
6232 |
|
|
6211 |
6233 |
: Suppose a "PRODUCES" relationship with an attribute "Amount" exists between a "PRODUCER" entity type and a "MOVIE" entity type, with ratio $1:M$. |
: Suppose a "PRODUCES" relationship with an attribute "Amount" exists between a "PRODUCER" entity type and a "MOVIE" entity type, with ratio $1:M$. |
6212 |
6234 |
Migrate the "Amount" attribute to one of the entity types and draw the resulting diagram. |
Migrate the "Amount" attribute to one of the entity types and draw the resulting diagram. |
6213 |
6235 |
|
|
|
... |
... |
Solution +.# |
6438 |
6460 |
|
|
6439 |
6461 |
Solution +.# |
Solution +.# |
6440 |
6462 |
|
|
6441 |
|
: A useful decomposition of an email address attribute could be: the username part before the @ sign, and the domain part afterwards. |
|
|
6463 |
|
: A useful decomposition of an email address attribute could be: the username part before the `@` sign, and the domain part afterwards (that could even be sub-divided between the domain name and its top-level domain). |
6442 |
6464 |
It might be useful to have statistics about the domains of the users or to sort the usernames by length, etc. |
It might be useful to have statistics about the domains of the users or to sort the usernames by length, etc. |
6443 |
6465 |
|
|
|
6466 |
|
Solution +.# |
|
6467 |
|
|
|
6468 |
|
: Having a "Phone" attribute being multi-valued would allow to store multiple phone numbers for the same entity. Typically, one would want to store a pair (Number, Description) for their office phone, their cell, etc. |
|
6469 |
|
The resulting attribute would be drawn as follows: |
|
6470 |
|
 |
|
6471 |
|
|
|
6472 |
|
|
6444 |
6473 |
Solution +.# |
Solution +.# |
6445 |
6474 |
|
|
6446 |
6475 |
:  |
:  |
|
... |
... |
Solution +.# |
6484 |
6513 |
|
|
6485 |
6514 |
: The two possible structural constraints on a relationship type are the cardinality ratio and participation constraints. |
: The two possible structural constraints on a relationship type are the cardinality ratio and participation constraints. |
6486 |
6515 |
|
|
|
6516 |
|
Solution +.# |
|
6517 |
|
~ |
|
6518 |
|
We would obtain the following diagram: |
|
6519 |
|
|
|
6520 |
|
 |
|
6521 |
|
|
|
6522 |
|
Note that the "M / N" part could be discussed: having 1 instead of M would mean that a videogame that is a sequel is the sequel of at most one videogame. This could make sense, but would forbid for instance to register "Battletoads & Double Dragon - The Ultimate Team" as the sequel of both Double Dragon and Battletoads. Having 1 instead of N would mean that every videogame has at most one sequel: it would prevent from registering both "Super Mario Land" and "Super Mario World" as the sequels of "Super Mario Bros. 3". |
|
6523 |
|
|
|
6524 |
|
However, note that all the participation constraints are partial: having a total participation constraint would mean (on the left side) that every game is a sequel, or (on the right side) that every game have at least one sequel, two statements that are obviously wrong. |
|
6525 |
|
|
6487 |
6526 |
Solution +.# |
Solution +.# |
6488 |
6527 |
~ |
~ |
6489 |
6528 |
We would obtain the following diagram: |
We would obtain the following diagram: |
|
... |
... |
Solution +.# |
6539 |
6578 |
: An attribute of a binary relationship type can be migrated to one of the participating entity types when the cardinality ratio is $1:N$, $1:1$, or $N:1$. It can be migrated "to the $N$ side" or, if there is no $N$ side, to either side. |
: An attribute of a binary relationship type can be migrated to one of the participating entity types when the cardinality ratio is $1:N$, $1:1$, or $N:1$. It can be migrated "to the $N$ side" or, if there is no $N$ side, to either side. |
6540 |
6579 |
Note that for $n$-ary relationships, at least one ratio needs to be $1$ for the attribute to be allowed to migrate (and "to the $N$ side", or, if there is no $N$ side, to any side). |
Note that for $n$-ary relationships, at least one ratio needs to be $1$ for the attribute to be allowed to migrate (and "to the $N$ side", or, if there is no $N$ side, to any side). |
6541 |
6580 |
|
|
|
6581 |
|
Solution +.# |
|
6582 |
|
~ |
|
6583 |
|
|
|
6584 |
|
#. A ticket must be opened by a exactly one user, and an user can open any number of tickets (including 0). |
|
6585 |
|
#. We could migrate the "FromIP" attribute to the "TICKET" entity: the intuition is that while the IP adress of a user can evolve through time, the IP used at the time of creation of the ticket is unique to the ticket, and hence can become an attribute of the ticket. |
|
6586 |
|
|
6542 |
6587 |
|
|
6543 |
6588 |
Solution +.# |
Solution +.# |
6544 |
6589 |
~ |
~ |
|
... |
... |
Solution to [%D %n (%T)](#problem:reverseeng) |
7810 |
7855 |
|
|
7811 |
7856 |
## Resources {-} |
## Resources {-} |
7812 |
7857 |
|
|
7813 |
|
- <http://spots.augusta.edu/caubert/teaching/general/java/> |
|
|
7858 |
|
- <https://spots.augusta.edu/caubert/teaching/general/java/> |
7814 |
7859 |
- 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. |
7815 |
7860 |
- [@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. |
7816 |
7861 |
- Many textbooks on Java include a part on Databases, just like this one: [@Gaddis2014, Chapter 16]. |
- Many textbooks on Java include a part on Databases, just like this one: [@Gaddis2014, Chapter 16]. |
|
... |
... |
We will come back to this when we explore our first program. |
7860 |
7905 |
|
|
7861 |
7906 |
## Flash Intro to Java |
## Flash Intro to Java |
7862 |
7907 |
|
|
7863 |
|
For a quick introduction to Java, cf. <http://spots.augusta.edu/caubert/teaching/general/java/>. |
|
|
7908 |
|
For a quick introduction to Java, cf. <https://spots.augusta.edu/caubert/teaching/general/java/>. |
7864 |
7909 |
|
|
7865 |
7910 |
--- |
--- |
7866 |
7911 |
|
|