Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Added example about self-referencing tuple. | 0392e724d84f2a9264fec4be188fa74ef795266a | caubert | 2021-08-30 18:56:34 |
Clarified what a mini-world is. | 7bc9938cbdcc8be11cd61c74899b330d626ec2b5 | caubert | 2021-08-25 16:23:12 |
Added emoji support and cleaned. | f7b577db596410737f72c93fbcab615b53226ac5 | aubert@math.cnrs.fr | 2021-08-17 13:35:36 |
Finished final from previous semester. | 7622ebd223bbbabaed014a175a0be5da7aff5d6f | caubert | 2021-08-13 17:05:28 |
Added final for Spring 2021. | 6a4a0d94151df7ab940c814637be8ee5136de850 | caubert | 2021-08-13 16:55:09 |
Typo | f1acfa7bcd31233571e74e176ee2a38880c08d72 | caubert | 2021-05-07 02:55:17 |
Added second problem of final. | 38c448de2d0e38bf50efcf1b1da3e0a45def1707 | caubert | 2021-05-07 01:42:05 |
Added first exercise of final. | df858593f1d47ff3442bcb6216b90605d81e0e1c | caubert | 2021-05-06 22:26:09 |
Fixed mongo db and added quiz 4$ | 7f0f4b98f4b293927185ed3cb080554eb3af867c | caubert | 2021-04-23 19:15:53 |
Finishing with Exam 2 | 4e0eb343744b5f39ac32145ca7dc61a26b3f48ee | caubert | 2021-04-09 20:33:48 |
Added problem and solution of second exam | 2b344a25e84c7ebc827c1503151981380ec08f31 | caubert | 2021-04-07 18:08:08 |
Worked on exam 2 | 649fce8b5cbc3f5a98ae905ae8cc56d8baa5df99 | caubert | 2021-04-06 19:18:54 |
Clarification on sql injection. | f9450ef20ef15cc048c1c2775cbf5e29c4be7255 | caubert | 2021-03-31 14:56:56 |
Added an example of batch processing of prepared statement. | f83adc39b5066412fa78fdc0aeccb51ccdba908a | caubert | 2021-03-31 13:39:52 |
Added an example of batch processing of prepared statement. | c206f2899162396a7f391728db8be23031253454 | caubert | 2021-03-31 13:38:48 |
Fixed pb (CONSULTATION relation: justification, primary key and normal form) | 14aef6161421064f879c5fe803abb4836eebba0a | caubert | 2021-03-25 20:58:59 |
Fixed pb (CONSULTATION relation: justification, primary key and normal form) | be645c3e4215fd02ed089b843582d8c870525366 | caubert | 2021-03-25 20:55:34 |
Fixes in the DB app chapter. | 50082333323792958b213f9b0e5e7dc3a2ed47c5 | caubert | 2021-03-24 18:46:24 |
Fixed some include code. | 9caf6bc12caded947f222cb03fa0c1b10f2c8041 | caubert | 2021-03-24 13:11:20 |
Added question from quiz #3 | 7426197119517bff992e7753174de82ae3ff7ed7 | caubert | 2021-03-22 16:37:09 |
File | Lines added | Lines deleted |
---|---|---|
notes/code/sql/HW_FK_Self_Reference.sql | 15 | 0 |
notes/code/sql/HW_FKtest.sql | 0 | 2 |
notes/lectures_notes.md | 9 | 0 |
File notes/code/sql/HW_FK_Self_Reference.sql added (mode: 100644) (index 0000000..392fbac) | |||
1 | /* code/sql/HW_FK_Self_Reference.sql */ | ||
2 | |||
3 | DROP SCHEMA IF EXISTS HW_FK_Self_Reference; | ||
4 | CREATE SCHEMA HW_FK_Self_Reference; | ||
5 | USE HW_FK_Self_Reference; | ||
6 | |||
7 | -- start snippet demo | ||
8 | CREATE TABLE TEST ( | ||
9 | ID Int PRIMARY KEY, | ||
10 | Reference INT, | ||
11 | FOREIGN KEY (Reference) REFERENCES TEST (ID) | ||
12 | ); | ||
13 | |||
14 | INSERT INTO TEST VALUES (1, 1); | ||
15 | -- end snippet demo |
File notes/code/sql/HW_FKtest.sql changed (mode: 100644) (index 1364384..96d4268) | |||
1 | 1 | /* code/sql/HW_FKtest.sql */ | /* code/sql/HW_FKtest.sql */ |
2 | 2 | DROP SCHEMA IF EXISTS HW_FKtest; | DROP SCHEMA IF EXISTS HW_FKtest; |
3 | |||
4 | 3 | CREATE SCHEMA HW_FKtest; | CREATE SCHEMA HW_FKtest; |
5 | |||
6 | 4 | USE HW_FKtest; | USE HW_FKtest; |
7 | 5 | ||
8 | 6 | CREATE TABLE TARGET ( | CREATE TABLE TARGET ( |
File notes/lectures_notes.md changed (mode: 100644) (index c769348..04e6b96) | |||
... | ... | DEPARTMENT(Code (PK), Name, Head (FK to PROF.Login)) | |
2082 | 2082 | ](fig/rel_mod/professor_department) | ](fig/rel_mod/professor_department) |
2083 | 2083 | \ | \ |
2084 | 2084 | ||
2085 | Then note that we cannot create both tables as pictured directly, as PROF requires DEPARTMENT to exist, to have a foreign key referencing it, and similarly for DEPARTMENT: it is an egg and chicken situation! | ||
2086 | Hence, we have to first create a table without the foreign key, and then add it later on, as described below: | ||
2087 | |||
2085 | 2088 | ||
2086 | 2089 | ```{.sqlmysql .numberLines .includeLink include=code/sql/HW_ProfExample.sql snippet=tables-1} | ```{.sqlmysql .numberLines .includeLink include=code/sql/HW_ProfExample.sql snippet=tables-1} |
2087 | 2090 | ``` | ``` |
... | ... | Note the structure of the `ALTER TABLE` command: | |
2095 | 2098 | ```{.sqlmysql .numberLines .includeLink include=code/sql/HW_ProfExample.sql snippet=tables-2} | ```{.sqlmysql .numberLines .includeLink include=code/sql/HW_ProfExample.sql snippet=tables-2} |
2096 | 2099 | ``` | ``` |
2097 | 2100 | ||
2101 | On a side note, note that we do not have the same difficulty when inserting a value in a table that contains a foreign key referencing itself: it is accepted to insert a value that is referencing itself, as illustrated below. | ||
2102 | |||
2103 | ```{.sqlmysql .numberLines .includeLink include=code/sql/HW_FK_Self_Reference.sql snippet=demo} | ||
2104 | ``` | ||
2105 | |||
2106 | |||
2098 | 2107 | #### Populating | #### Populating |
2099 | 2108 | ||
2100 | 2109 | We can insert multiple values at once: | We can insert multiple values at once: |