List of commits:
Subject Hash Author Date (UTC)
Clarification on SQL constraints. 70e26a02aa344cc1bf009a089623be6baac79ba7 aubert@math.cnrs.fr 2019-01-29 22:46:26
Adding some minor SQL remarks + code for HW_FACULTY. 1d1b74302d29fb63c3c2bacca30533283f720997 aubert@math.cnrs.fr 2019-01-25 17:24:16
fixing small typo. 0feeb8df61e05d6d0990120628303cf31108f100 aubert@math.cnrs.fr 2019-01-22 18:23:34
Quick fix + adding macOS install instructions. ea3063e4e9225c8ce66838c8bfddb9a34aadacf8 aubert@math.cnrs.fr 2019-01-16 15:59:38
Fixing a few typos and adding a drawing. b335800d4129c8e29763a6c1d564243d485fa51b aubert@math.cnrs.fr 2019-01-15 19:03:38
Fixing first homework 3eeb05a78235274a330c780f4f26b5fed1a01aef aubert@math.cnrs.fr 2019-01-08 19:50:29
Added content of various exam, fixed intro, added references, solutions, fixed types. a8e9d2d4856133d68d882403cde42dfcc2f5cc69 aubert@math.cnrs.fr 2019-01-07 16:47:02
Cleaning files and makefile 7605a6530505ad69042413dd995d77f1814c2f30 au 2018-12-24 14:25:31
Fixed margin for PDF, added a couple of SVG images, fixed some problems, added some code. eb83d9f07d738df7ab2515b768d6165a3b7e5ca3 au 2018-12-24 02:28:36
Working on rel_mod for Prof_Department_Extended. 2b1eff83797fbda620189f014043d648c884e887 au 2018-12-23 22:38:07
Working on FD and various figures. 8fd7f8322e70ae252596aa9cb88918ac40d5aa84 au 2018-12-23 20:25:19
Added first drawing for fd. 2a0e4fc716d91c23c81346a0e3b568f7132284c9 au 2018-12-23 05:23:29
Cleaned latex code. 1cf04e85915d24fc0208b407eb0166803b2369cf au 2018-12-23 04:27:41
Working on drawing for functional dependencies. 7dc167021630c00be25881877c0921adbc87f482 au 2018-12-23 04:20:33
Working on style for functional dependencies graph. 029c32395ba1110ad2af980e248848e0877040d7 au 2018-12-23 00:17:54
Working on template for FD. 091bb061b6fea06f440e97a4c9ac0f69b4ea1392 au 2018-12-22 20:57:00
Started to work on Functional Dep. 2123fbafc3b8258184ad745d8f23521a3f477d0e au 2018-12-22 18:53:20
Fixing a couple of problem, adding some more correct figures. ef44b65f45fba2bd9a653b639287d872b9f7471d au 2018-12-22 04:27:34
Fixing two figures, and renaming them. 71f4ab9c4090e97da19089f2316e87a4ebe838d6 au 2018-12-22 02:37:15
Fixing some of the name of the problems + references. 67c6c669fbb952cdd92be94487f46774da086a59 au 2018-12-21 16:20:08
Commit 70e26a02aa344cc1bf009a089623be6baac79ba7 - Clarification on SQL constraints.
Author: aubert@math.cnrs.fr
Author date (UTC): 2019-01-29 22:46
Committer name: aubert@math.cnrs.fr
Committer date (UTC): 2019-01-29 22:46
Parent(s): 1d1b74302d29fb63c3c2bacca30533283f720997
Signer:
Signing key:
Signing status: N
Tree: d08a76bc14b05c14f17e42dfcc28533ef09919ab
File Lines added Lines deleted
notes/lectures_notes.md 26 1
File notes/lectures_notes.md changed (mode: 100644) (index 6f4fa83..aa3bffc)
... ... DESCRIBE <TableName>; -- Show the structure of a table
994 994 SELECT * FROM <TableName> -- List all the rows in a table SELECT * FROM <TableName> -- List all the rows in a table
995 995 DROP TABLE <TableName>; -- "Drop" (erase) a table DROP TABLE <TableName>; -- "Drop" (erase) a table
996 996 DROP SCHEMA <SchemaName>; -- Drop a schema DROP SCHEMA <SchemaName>; -- Drop a schema
997 SHOW WARNINGS; -- After a warning was issued, show the content of the warning.
997 998 ~~~ ~~~
998 999
999 1000 <!-- <!--
 
... ... CREATE TABLE HURRICANE(
1019 1020 WindSpeed INT DEFAULT 76, WindSpeed INT DEFAULT 76,
1020 1021 Above VARCHAR(25) Above VARCHAR(25)
1021 1022 ); );
1023 -- WindSpeed INT CHECK (WindSpeed > 74 AND WindSpeed < 500),
1022 1024 -- would be parsed but wouldn't have any effect! -- would be parsed but wouldn't have any effect!
1023 1025
1024 1026 CREATE TABLE STATE( CREATE TABLE STATE(
 
... ... MariaDB [HW_CONSTRAINTS_PART1]> DESCRIBE STATE;
1052 1053 ~~~ ~~~
1053 1054
1054 1055 ~~~{.sqlmysql .numberLines} ~~~{.sqlmysql .numberLines}
1056 --
1057 -- Primary Keys
1058 --
1059
1055 1060 -- Adding a primary key: -- Adding a primary key:
1056 1061 ALTER TABLE STATE ADD PRIMARY KEY (Name); ALTER TABLE STATE ADD PRIMARY KEY (Name);
1057 1062
1058 1063 -- Removing the primary key: -- Removing the primary key:
1059 1064 ALTER TABLE STATE DROP PRIMARY KEY; ALTER TABLE STATE DROP PRIMARY KEY;
1060 1065
1066 --
1067 -- UNIQUE Constraint
1068 --
1069
1061 1070 -- Adding a UNIQUE constraint -- Adding a UNIQUE constraint
1062 1071 ALTER TABLE STATE ADD UNIQUE (Postal_abbr); ALTER TABLE STATE ADD UNIQUE (Postal_abbr);
1063 1072
1064 1073 -- Removing a UNIQUE constraint -- Removing a UNIQUE constraint
1065 1074 ALTER TABLE STATE DROP INDEX Postal_abbr; ALTER TABLE STATE DROP INDEX Postal_abbr;
1066 1075
1076 --
1077 -- NOT NULL Constraint
1078 --
1079
1067 1080 -- Adding the NOT NULL constraint -- Adding the NOT NULL constraint
1068 1081 ALTER TABLE STATE MODIFY Postal_abbr CHAR(2) NOT NULL; ALTER TABLE STATE MODIFY Postal_abbr CHAR(2) NOT NULL;
1069 1082
1070 1083 -- Removing the NOT NULL constraint -- Removing the NOT NULL constraint
1071 1084 ALTER TABLE STATE MODIFY Postal_abbr CHAR(2); ALTER TABLE STATE MODIFY Postal_abbr CHAR(2);
1072 1085
1086 --
1087 -- Default value
1088 --
1089
1073 1090 -- Changing the default value -- Changing the default value
1074 1091 ALTER TABLE HURRICANE ALTER COLUMN WindSpeed SET DEFAULT 74; ALTER TABLE HURRICANE ALTER COLUMN WindSpeed SET DEFAULT 74;
1075 1092
1076 1093 -- Removing the default value -- Removing the default value
1077 1094 ALTER TABLE HURRICANE ALTER COLUMN WindSpeed DROP DEFAULT; ALTER TABLE HURRICANE ALTER COLUMN WindSpeed DROP DEFAULT;
1078 1095
1096 --
1097 -- Foreign key
1098 --
1099
1079 1100 --Adding a foreign key constraint --Adding a foreign key constraint
1080 1101 ALTER TABLE HURRICANE ADD FOREIGN KEY (Above) REFERENCES STATE(Name); ALTER TABLE HURRICANE ADD FOREIGN KEY (Above) REFERENCES STATE(Name);
1102
1103 -- Removing a foreign key constraint is out of the scope of this lecture.
1104 -- If you are curious, you can have a look at https://www.w3schools.com/sql/sql_foreignkey.asp
1105 -- Dropping a foreign key constraint requires your constraint to have a name, something we did not introduce.
1081 1106 ~~~ ~~~
1082 1107
1083 1108 - `NOT NULL`{.sqlmysql} is to some extend part of the datatype. - `NOT NULL`{.sqlmysql} is to some extend part of the datatype.
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