From 38c59778eb2eb328fa57b637361f5e9140082d98 Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 12:46:37 -0400 Subject: [PATCH 1/8] create a new database called myNewDB --- .idea/.gitignore | 5 +++++ .idea/SQL.BuildAndDestroy.iml | 8 ++++++++ .idea/dataSources.xml | 14 ++++++++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 41 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/SQL.BuildAndDestroy.iml create mode 100644 .idea/dataSources.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..7a47212 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/SQL.BuildAndDestroy.iml b/.idea/SQL.BuildAndDestroy.iml new file mode 100644 index 0000000..0399c4b --- /dev/null +++ b/.idea/SQL.BuildAndDestroy.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..0c1fe3a --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,14 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306 + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9bfba77 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 383479ab7539febe0d2193cc257aee5d16bd2034 Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 14:00:50 -0400 Subject: [PATCH 2/8] exercise2 drop database --- .idea/.gitignore | 6 ++++++ .idea/SQL.BuildAndDestroy.iml | 8 ++++++++ .idea/dataSources.xml | 11 +++++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ answers/exercise1.sql | 6 ++++++ answers/exercise2.sql | 2 ++ answers/exercise3.sql | 1 + import/.idea/.gitignore | 2 ++ import/.idea/import.iml | 8 ++++++++ import/.idea/modules.xml | 8 ++++++++ import/.idea/vcs.xml | 6 ++++++ 12 files changed, 72 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/SQL.BuildAndDestroy.iml create mode 100644 .idea/dataSources.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 import/.idea/.gitignore create mode 100644 import/.idea/import.iml create mode 100644 import/.idea/modules.xml create mode 100644 import/.idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..0ed6303 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,6 @@ +# Default ignored files +/workspace.xml + +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml \ No newline at end of file diff --git a/.idea/SQL.BuildAndDestroy.iml b/.idea/SQL.BuildAndDestroy.iml new file mode 100644 index 0000000..0399c4b --- /dev/null +++ b/.idea/SQL.BuildAndDestroy.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..e354acb --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,11 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306 + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9bfba77 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/answers/exercise1.sql b/answers/exercise1.sql index e69de29..4b7adc4 100644 --- a/answers/exercise1.sql +++ b/answers/exercise1.sql @@ -0,0 +1,6 @@ +CREATE DATABASE myNewDB; + + + + + diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..1c3d92b 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -0,0 +1,2 @@ +show databases; +DROP DATABASE myNewDB; \ No newline at end of file diff --git a/answers/exercise3.sql b/answers/exercise3.sql index e69de29..22f2b59 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1 @@ +show databases; \ No newline at end of file diff --git a/import/.idea/.gitignore b/import/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/import/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/import/.idea/import.iml b/import/.idea/import.iml new file mode 100644 index 0000000..0399c4b --- /dev/null +++ b/import/.idea/import.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/import/.idea/modules.xml b/import/.idea/modules.xml new file mode 100644 index 0000000..e33a421 --- /dev/null +++ b/import/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/import/.idea/vcs.xml b/import/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/import/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 1ca6dec19219d180019a9e6d8e69ecb4b94136cc Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 15:15:09 -0400 Subject: [PATCH 3/8] create table --- answers/exercise2.sql | 1 + answers/exercise3.sql | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/answers/exercise2.sql b/answers/exercise2.sql index 8b13789..23ae007 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -1 +1,2 @@ +show databases; diff --git a/answers/exercise3.sql b/answers/exercise3.sql index 22f2b59..290d23d 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -1 +1,15 @@ -show databases; \ No newline at end of file +show databases; +CREATE DATABASE myNewDB; + +USE myNewDB; +DROP TABLE Users; + +CREATE TABLE Users( + UserID INT, + LastName VARCHAR(255), + FirstName VARCHAR(255), + Address VARCHAR(255), + City VARCHAR(255) +); + +SELECT * FROM users; From 779f5ac23cdab74942a3bc4efa4994c53e22394d Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 15:34:20 -0400 Subject: [PATCH 4/8] delete table --- answers/exercise4.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/answers/exercise4.sql b/answers/exercise4.sql index e69de29..7333d0c 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -0,0 +1,5 @@ +show databases; +DROP TABLE Users +SHOW TABLES; + + From 07cbb49e63d999b80c712d6fc8d4720a8d06f7b8 Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 15:45:14 -0400 Subject: [PATCH 5/8] Truncate table --- answers/exercise4.sql | 3 ++- answers/exercise5.sql | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/answers/exercise4.sql b/answers/exercise4.sql index 7333d0c..b1417d7 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -1,5 +1,6 @@ show databases; -DROP TABLE Users + +DROP TABLE Users; SHOW TABLES; diff --git a/answers/exercise5.sql b/answers/exercise5.sql index e69de29..7883bd7 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -0,0 +1,16 @@ +SHOW DATABASES; +use myNewDB; + +CREATE TABLE Users( + UserID INT, + LastName VARCHAR(255), + FirstName VARCHAR(255), + Address VARCHAR(255), + City VARCHAR(255) +); + +INSERT INTO Users (UserID) +VALUES(255); +TRUNCATE TABLE Users; + +SELECT * FROM Users; \ No newline at end of file From b87b8d90b48cd25e255c140e3ad6b37d015e800c Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 16:30:05 -0400 Subject: [PATCH 6/8] add Birthday Date to User Table --- answers/exercise5.sql | 3 ++- answers/exercise6.sql | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/answers/exercise5.sql b/answers/exercise5.sql index 7883bd7..e4a3ac9 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -6,7 +6,8 @@ CREATE TABLE Users( LastName VARCHAR(255), FirstName VARCHAR(255), Address VARCHAR(255), - City VARCHAR(255) + City VARCHAR(255), + Birthday DATE ); INSERT INTO Users (UserID) diff --git a/answers/exercise6.sql b/answers/exercise6.sql index e69de29..3eeafb1 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,9 @@ +SHOW DATABASES; +use myNewDB; + +SHOW TABLES; + +ALTER TABLE Users + ADD Birthday DATE; + +SELECT * FROM Users; \ No newline at end of file From 22506116ca9f6711c5688fd98593dd408b6dbd19 Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 16:34:14 -0400 Subject: [PATCH 7/8] Delete the column Birthday from the Users table --- answers/exercise6.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/answers/exercise6.sql b/answers/exercise6.sql index 3eeafb1..38ddebf 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -1,9 +1,7 @@ SHOW DATABASES; use myNewDB; -SHOW TABLES; - ALTER TABLE Users - ADD Birthday DATE; + DROP COLUMN Birthday; SELECT * FROM Users; \ No newline at end of file From df81d24bbe6c78743f04f2a2335769e12a39ab13 Mon Sep 17 00:00:00 2001 From: April Howard Date: Wed, 11 Mar 2020 16:36:11 -0400 Subject: [PATCH 8/8] Delete the Delete the column Birthday from the Users table in exercise 7 --- answers/exercise7.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/answers/exercise7.sql b/answers/exercise7.sql index e69de29..38ddebf 100644 --- a/answers/exercise7.sql +++ b/answers/exercise7.sql @@ -0,0 +1,7 @@ +SHOW DATABASES; +use myNewDB; + +ALTER TABLE Users + DROP COLUMN Birthday; + +SELECT * FROM Users; \ No newline at end of file