File notes/lectures_notes.md changed (mode: 100644) (index ee49d1c..327de2e) |
... |
... |
base: https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/blo |
37 |
37 |
|
|
38 |
38 |
## How to Use This Guide {-} |
## How to Use This Guide {-} |
39 |
39 |
|
|
|
40 |
|
### How to Read This Guide {-} |
|
41 |
|
|
40 |
42 |
These lecture notes are written in an elusive style: they are a support for the explanations that will be made at the board. |
These lecture notes are written in an elusive style: they are a support for the explanations that will be made at the board. |
41 |
43 |
<!-- They are not designed to be self-contained: they are rather a list of topics and reminders, along with handy examples, code and drawings. --> |
<!-- They are not designed to be self-contained: they are rather a list of topics and reminders, along with handy examples, code and drawings. --> |
42 |
44 |
Reading them before coming to the lecture will help you getting a sense of the next topic we will be discussing, but you may sometimes have trouble deciphering their … *unique* style. |
Reading them before coming to the lecture will help you getting a sense of the next topic we will be discussing, but you may sometimes have trouble deciphering their … *unique* style. |
43 |
45 |
|
|
44 |
|
When it comes to code, you can normally copy-and-paste it from the document and use it as it is. |
|
45 |
|
Or, you can browse the source code of the code snippets at <https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/tree/notes/code> to download it directly. |
|
46 |
|
Some portion of code starts with a path in comment, and are followed by a link, like so: |
|
47 |
46 |
|
|
|
47 |
|
On top of the notes, you will find in this document: |
48 |
48 |
|
|
49 |
|
```{.sqlmysql .numberLines .includeLink include=code/sql/HW_HelloWorld.sql} |
|
|
49 |
|
- [References, at the very end of this document](#references), |
|
50 |
|
- and for each chapter, |
|
51 |
|
- A list of additional resources, |
|
52 |
|
- A list of short exercises, |
|
53 |
|
- Solution to those exercises, |
|
54 |
|
- A list of problem, |
|
55 |
|
- Solution to some of those problems. |
|
56 |
|
|
|
57 |
|
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. |
|
58 |
|
The syllabus is at <https://spots.augusta.edu/caubert/db/>, and the webpage for those notes is at <https://spots.augusta.edu/caubert/db/ln/>. |
|
59 |
|
|
|
60 |
|
Please, refer to those notes using this entry [@AubertCSCI3410-DatabaseSystems]: |
|
61 |
|
|
|
62 |
|
```{.bibtex .includeLink include=bib/entry.bib} |
50 |
63 |
``` |
``` |
51 |
64 |
|
|
52 |
|
This means that this code can be found at [https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/**blob/notes/code/sql/HW_HelloWorld.sql**](https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/blob/notes/code/sql/HW_HelloWorld.sql), and that you can click the link directly to access it^[This feature was [actually implemented by a student!](https://github.com/owickstrom/pandoc-include-code/pull/36).]. |
|
|
65 |
|
### How to Access the Code in This Guide {-} |
53 |
66 |
|
|
|
67 |
|
There are four way to access the code shared in those lecture notes: |
|
68 |
|
|
|
69 |
|
#. You can simply copy-and-paste it from the document and use it as it is. |
|
70 |
|
#. You can browse the source code of the code snippets at <https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/tree/notes/code> to download them directly. |
|
71 |
|
#. You can clone the repository containing the notes, figures and code snippets to have a local copy of it. You can find instructions on how to do that at <https://spots.augusta.edu/caubert/db/ln/README.html>. Instructions on how to compile those notes and how to contribute are linked from this document, if you are curious. |
|
72 |
|
#. You can use the links enclosed in the document. |
|
73 |
|
|
|
74 |
|
For this latter aspect, note that some portion of code starts with a path in comment, and are followed by a link, like so: |
|
75 |
|
|
|
76 |
|
```{.sqlmysql .numberLines .includeLink include=code/sql/HW_HelloWorld.sql} |
|
77 |
|
``` |
|
78 |
|
|
|
79 |
|
This means that this code can be found at |
|
80 |
|
|
|
81 |
|
[https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/ |
|
82 |
|
blob/notes/**code/sql/HW_HelloWorld.sql**](https://rocketgit.com/user/caubert/CSCI_3410/source/tree/branch/master/blob/notes/code/sql/HW_HelloWorld.sql) |
|
83 |
|
|
|
84 |
|
and that you can click the link below the code directly to access it^[This feature was [actually implemented by a student!](https://github.com/owickstrom/pandoc-include-code/pull/36).]. |
|
85 |
|
|
|
86 |
|
|
54 |
87 |
The `SQL` code frequently starts with |
The `SQL` code frequently starts with |
55 |
88 |
|
|
56 |
89 |
``` |
``` |
|
... |
... |
USE HW_NAME_OF_SCHEMA; |
62 |
95 |
This parts starts by deleting the schema `HW_NAME_OF_SCHEMA` if it exists, then create and use it: it allows the code to run independently of your installation. |
This parts starts by deleting the schema `HW_NAME_OF_SCHEMA` if it exists, then create and use it: it allows the code to run independently of your installation. |
63 |
96 |
It needs to be used with care, though, since it would delete everything you have in the `HW_NAME_OF_SCHEMA` schema before re-creating it, but empty. |
It needs to be used with care, though, since it would delete everything you have in the `HW_NAME_OF_SCHEMA` schema before re-creating it, but empty. |
64 |
97 |
|
|
65 |
|
Finally, the comments `-- start snippet something` and `-- end snippet something` can be ignored, as their are an artifice from [pandoc-include-code](https://github.com/owickstrom/pandoc-include-code) to select which portion of the code to display. |
|
|
98 |
|
Finally, the comments |
66 |
99 |
|
|
67 |
|
<!--: the colors and the ↪ `↪` ↪ ${\tiny\hookrightarrow}$, \tiny\ensuremath{\hookrightarrow} symbols are here to ease the reading, but you can ignore them safely.--> |
|
|
100 |
|
``` |
|
101 |
|
-- start snippet something |
|
102 |
|
``` |
68 |
103 |
|
|
69 |
|
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>. |
|
70 |
|
Instructions on how to compile those notes and how to contribute are linked from this document. |
|
|
104 |
|
and |
71 |
105 |
|
|
72 |
|
On top of the notes, you will find in this document: |
|
|
106 |
|
``` |
|
107 |
|
-- end snippet something |
|
108 |
|
``` |
|
109 |
|
|
|
110 |
|
can be ignored, as their are an artifice from [pandoc-include-code](https://github.com/owickstrom/pandoc-include-code) to select which portion of the code to display in those notes. |
|
111 |
|
|
|
112 |
|
<!--: the colors and the ↪ `↪` ↪ ${\tiny\hookrightarrow}$, \tiny\ensuremath{\hookrightarrow} symbols are here to ease the reading, but you can ignore them safely.--> |
73 |
113 |
|
|
74 |
|
- [References, at the very end of this document](#references) |
|
75 |
|
- and for each chapter, |
|
76 |
|
- A list of additional resources, |
|
77 |
|
- A list of short exercises, |
|
78 |
|
- 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]: |
|
79 |
114 |
|
|
80 |
|
```{.bibtex .includeLink include=bib/entry.bib} |
|
81 |
|
``` |
|
82 |
115 |
|
|
83 |
116 |
## Planned Schedule {-} |
## Planned Schedule {-} |
84 |
117 |
|
|
|
... |
... |
marks the (usual) separation between two lectures. |
107 |
140 |
|
|
108 |
141 |
## Exams Yearbooks {-} |
## Exams Yearbooks {-} |
109 |
142 |
|
|
110 |
|
To give you a sense of what you will be asked during the exams, or simply to practise, please find below the exams given previous semesters, in reverse chronological order. |
|
|
143 |
|
To give you a sense of what you will be asked during the exams, quizzes and projects, or simply to practise, please find below the exams given previous semesters, in reverse chronological order. |
111 |
144 |
The quizzes are not indicated, but were generally a mix of up to five exercises and one problem from the relevant chapter(s). |
The quizzes are not indicated, but were generally a mix of up to five exercises and one problem from the relevant chapter(s). |
112 |
145 |
|
|
113 |
146 |
### Fall 2020 {-} |
### Fall 2020 {-} |
|
... |
... |
A second project, more ambitious, was also asked from the students, and accounte |
220 |
253 |
|
|
221 |
254 |
## Typesetting and Acknowledgments {-} |
## Typesetting and Acknowledgments {-} |
222 |
255 |
|
|
223 |
|
The source code for those notes is hosted at [rocketgit](https://rocketgit.com/user/caubert/CSCI_3410), typeset in [markdown](https://commonmark.org/), and then compiled using [pandoc](https://pandoc.org/) and multiple filters ([pandoc-numbering](https://github.com/chdemko/pandoc-numbering), [pandoc-citeproc](https://github.com/jgm/pandoc-citeproc), [pandoc-include-code](https://github.com/owickstrom/pandoc-include-code)). |
|
|
256 |
|
The source code for those notes is hosted at [rocketgit](https://rocketgit.com/user/caubert/CSCI_3410), typeset in [markdown](https://commonmark.org/), and then compiled using [pandoc](https://pandoc.org/) and multiple filters ([pandoc-numbering](https://github.com/chdemko/pandoc-numbering), the [citeproc library](https://github.com/jgm/citeproc), [pandoc-include-code](https://github.com/owickstrom/pandoc-include-code)). |
224 |
257 |
The drawings use various [LaTeX](https://www.latex-project.org/) packages, including [PGF, TikZ](https://sourceforge.net/projects/pgf/), [tikz-er2](https://bitbucket.org/pavel_calado/tikz-er2/raw/da9f9f7f169647cad6d91df7975400b1605ae67a/tikz-er2.sty), [pgf-umlcd](https://github.com/pgf-tikz/pgf-umlcd/) and [tikz-dependency](https://ctan.org/pkg/tikz-dependency). |
The drawings use various [LaTeX](https://www.latex-project.org/) packages, including [PGF, TikZ](https://sourceforge.net/projects/pgf/), [tikz-er2](https://bitbucket.org/pavel_calado/tikz-er2/raw/da9f9f7f169647cad6d91df7975400b1605ae67a/tikz-er2.sty), [pgf-umlcd](https://github.com/pgf-tikz/pgf-umlcd/) and [tikz-dependency](https://ctan.org/pkg/tikz-dependency). |
225 |
258 |
The help from the [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/) community greatly improved this document. |
The help from the [TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/) community greatly improved this document. |
226 |
259 |
The u͟n͟d͟e͟r͟l͟i͟n͟e͟^[For technical reasons, underlined words cannot be searched in the document.] text is obtained using [YayText](https://yaytext.com/underline/), the unicode symbols are searched in the ["Unicode characters and corresponding LaTeX math mode commands"](http://milde.users.sourceforge.net/LUCR/Math/unimathsymbols.html). |
The u͟n͟d͟e͟r͟l͟i͟n͟e͟^[For technical reasons, underlined words cannot be searched in the document.] text is obtained using [YayText](https://yaytext.com/underline/), the unicode symbols are searched in the ["Unicode characters and corresponding LaTeX math mode commands"](http://milde.users.sourceforge.net/LUCR/Math/unimathsymbols.html). |
|
... |
... |
Those lecture notes were created under an [Affordable Learning Georgia](https:// |
234 |
267 |
|
|
235 |
268 |
{width=70%}\ |
{width=70%}\ |
236 |
269 |
|
|
|
270 |
|
Those lecture notes have greatly benefited from the contributions of many students, included but not limited to Crystal Anderson, Bobby Mcmanus, Minh Nguyen and Poonam Veeral. |
|
271 |
|
Additionally, Daniel Gozan, Mark Holcomb, Assya Sellak, Sydney Strong and Patrick Woolard helped [smash some bugs](https://spots.augusta.edu/caubert/projects/Capstone_Final_Document.pdf) in the tools used to produce this document. |
|
272 |
|
|
|
273 |
|
Please refer to <https://spots.augusta.edu/caubert/db/ln/README.html#authors-and-contributors> for a detail of the contributions. |
|
274 |
|
|
237 |
275 |
|
|
238 |
276 |
## Resources {-} |
## Resources {-} |
239 |
277 |
|
|
|
... |
... |
Let me introduce some of them: |
243 |
281 |
- [@Textbook6] and [@Textbook7] are two editions of an excellent and detailled book on Databases. It is commonly used, cover almost every aspect in a fairly accessible way. |
- [@Textbook6] and [@Textbook7] are two editions of an excellent and detailled book on Databases. It is commonly used, cover almost every aspect in a fairly accessible way. |
244 |
282 |
- [@Watt2014] is an open-source, cost-free textbook on Database design that can be of good support. |
- [@Watt2014] is an open-source, cost-free textbook on Database design that can be of good support. |
245 |
283 |
- [@NoSQLDistilled] and [@Sullivan2015] are two textbooks on the NoSQL approach that are short and good introductions. |
- [@NoSQLDistilled] and [@Sullivan2015] are two textbooks on the NoSQL approach that are short and good introductions. |
246 |
|
- To get started on Java and how it interfaces with databases, I believe [@Gaddis2014] is a good introduction. |
|
247 |
|
- [awesome-mysql](https://github.com/shlomi-noach/awesome-mysql#readme) is a "curated list of awesome MySQL free and opensource software, libraries and resources" that is definitely worth checking out. Among other ressources, note [this bank of SQL programming exercises](https://github.com/XD-DENG/SQL-exercise). |
|
|
284 |
|
- To get started on Java and how it interfaces with databases, [@Gaddis2014] is a good introduction. |
|
285 |
|
- [awesome-mysql](https://github.com/shlomi-noach/awesome-mysql#readme) is a "curated list of awesome MySQL free and opensource software, libraries and resources" that is definitely worth checking out. Among other resources, there is [this bank of SQL programming exercises](https://github.com/XD-DENG/SQL-exercise). |
248 |
286 |
|
|
249 |
287 |
Those resources are listed as complements, but it is not require to read them to understand the content of those notes. |
Those resources are listed as complements, but it is not require to read them to understand the content of those notes. |
250 |
288 |
[@Watt2014] --being available free of charge-- is more descriptive than the current notes, and as such can constitutes a great complement. |
[@Watt2014] --being available free of charge-- is more descriptive than the current notes, and as such can constitutes a great complement. |
|
... |
... |
In those lecture notes, we will introduce one of this tool--the `SQL` programmin |
297 |
335 |
We will also observe that a careful design is a mandatory step before implementing a catalog, and that how good a catalog is can be assessed, and introduce the tools to do so. |
We will also observe that a careful design is a mandatory step before implementing a catalog, and that how good a catalog is can be assessed, and introduce the tools to do so. |
298 |
336 |
Finally, we will discuss how an application interacting with a database can be implemented and secured, and the alternatives to `SQL` offered by the NoSQL approach, as well as the limitations and highlights of both models. |
Finally, we will discuss how an application interacting with a database can be implemented and secured, and the alternatives to `SQL` offered by the NoSQL approach, as well as the limitations and highlights of both models. |
299 |
337 |
|
|
300 |
|
## Database |
|
|
338 |
|
## What is a Database? |
301 |
339 |
|
|
302 |
340 |
A database (DB) is **a collection of related data**. |
A database (DB) is **a collection of related data**. |
303 |
|
Data (= information, can be anything, really) + management (= logical organization of the data), through **D**ata**b**ase **M**anagement **S**ystem. |
|
304 |
341 |
|
|
305 |
|
#. Represent a mini-world, a "Universe of Disclosure" (UoD). |
|
306 |
|
#. Logically coherent, with a meaning. |
|
307 |
|
#. Populated for a purpose. |
|
|
342 |
|
It has two components, the _data_ (= information, can be anything, really) and the _management_ (= logical organization) of the data, generally through a **D**ata**b**ase **M**anagement **S**ystem. |
|
343 |
|
|
|
344 |
|
A database |
|
345 |
|
|
|
346 |
|
#. Represents a mini-world, a "Universe of Disclosure" (UoD). |
|
347 |
|
#. Is logically coherent, with a meaning. |
|
348 |
|
#. Has been populated for a purpose. |
308 |
349 |
|
|
309 |
350 |
A DBMS has multiple components, as follows: |
A DBMS has multiple components, as follows: |
310 |
351 |
|
|
|
... |
... |
Note that |
317 |
358 |
- The program can be written in any language, be a web interface, etc. It is sometimes part of the software shipped with the DBMS, but not necessarily (you can, and we will, develop your own program to interact with the DBMS). |
- The program can be written in any language, be a web interface, etc. It is sometimes part of the software shipped with the DBMS, but not necessarily (you can, and we will, develop your own program to interact with the DBMS). |
318 |
359 |
- Most DBMS software includes a Command-Line Interface (CLI). |
- Most DBMS software includes a Command-Line Interface (CLI). |
319 |
360 |
- The catalog (or schema, meta-data^[The term "meta-data" has numerous definition ("data about the data"): we use it here to refer to the description of the organization of the data, and not e.g. to statistical data about the data.]) contains the description of how the data is stored, i.e., the datatypes, nature of the attributes, etc. |
- The catalog (or schema, meta-data^[The term "meta-data" has numerous definition ("data about the data"): we use it here to refer to the description of the organization of the data, and not e.g. to statistical data about the data.]) contains the description of how the data is stored, i.e., the datatypes, nature of the attributes, etc. |
320 |
|
- Sometimes, catalog and data are closer than pictured (you can have "self-describing meta-data", that is, they cannot be distinguished). |
|
|
361 |
|
- Sometimes, catalog and data are closer than pictured (you can have "self-describing meta-data", that is, they cannot be distinguished), this is typically the case in some of the NoSQL approaches. |
321 |
362 |
|
|
322 |
363 |
## Database Management System (DBMS) |
## Database Management System (DBMS) |
323 |
364 |
|
|
|
... |
... |
You can think of a tool to |
335 |
376 |
#. Allow to change its content, as well as its organization, |
#. Allow to change its content, as well as its organization, |
336 |
377 |
#. Allow multiple persons to access all or parts of it at the same time. |
#. Allow multiple persons to access all or parts of it at the same time. |
337 |
378 |
|
|
338 |
|
## Subtasks |
|
|
379 |
|
## How Are the Tasks Distributed? |
339 |
380 |
|
|
340 |
381 |
Exactly like a program can have |
Exactly like a program can have |
341 |
382 |
|
|