diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/SQL.BuildAndDestroy.iml b/.idea/SQL.BuildAndDestroy.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/SQL.BuildAndDestroy.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..b41d12f --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ 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..35eb1dd --- /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..07c2318 100644 --- a/answers/exercise1.sql +++ b/answers/exercise1.sql @@ -0,0 +1 @@ +CREATE DATABASE myNewDB; \ No newline at end of file diff --git a/answers/exercise10.sql b/answers/exercise10.sql index e69de29..31c02e0 100644 --- a/answers/exercise10.sql +++ b/answers/exercise10.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +WHERE City = 'Philadelphia' OR City = 'Trenton'; \ No newline at end of file diff --git a/answers/exercise11.sql b/answers/exercise11.sql index e69de29..5337c02 100644 --- a/answers/exercise11.sql +++ b/answers/exercise11.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +ORDER BY City; \ No newline at end of file diff --git a/answers/exercise12.sql b/answers/exercise12.sql index e69de29..7e22273 100644 --- a/answers/exercise12.sql +++ b/answers/exercise12.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +ORDER BY City DESC; \ No newline at end of file diff --git a/answers/exercise13.sql b/answers/exercise13.sql index e69de29..30c8123 100644 --- a/answers/exercise13.sql +++ b/answers/exercise13.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +ORDER BY Country, City; \ No newline at end of file diff --git a/answers/exercise14.sql b/answers/exercise14.sql index e69de29..30e8d38 100644 --- a/answers/exercise14.sql +++ b/answers/exercise14.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +WHERE PostalCode IS NULL; \ No newline at end of file diff --git a/answers/exercise15.sql b/answers/exercise15.sql index e69de29..fde2ca1 100644 --- a/answers/exercise15.sql +++ b/answers/exercise15.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +WHERE PostalCode IS NOT NULL; \ No newline at end of file diff --git a/answers/exercise16.sql b/answers/exercise16.sql index e69de29..a89e532 100644 --- a/answers/exercise16.sql +++ b/answers/exercise16.sql @@ -0,0 +1,2 @@ +UPDATE Students +Set City = 'Edinburgh'; \ No newline at end of file diff --git a/answers/exercise17.sql b/answers/exercise17.sql index e69de29..4c8668a 100644 --- a/answers/exercise17.sql +++ b/answers/exercise17.sql @@ -0,0 +1,3 @@ +Update Students +SET City = 'Edinburgh' +WHERE Country = 'Scotland'; \ No newline at end of file diff --git a/answers/exercise18.sql b/answers/exercise18.sql index e69de29..edf2e13 100644 --- a/answers/exercise18.sql +++ b/answers/exercise18.sql @@ -0,0 +1,3 @@ +UPDATE Students +SET City = 'Edinburgh', Country = 'Scotland' +WHERE StudentID = 35; \ No newline at end of file diff --git a/answers/exercise19.sql b/answers/exercise19.sql index e69de29..b5705f5 100644 --- a/answers/exercise19.sql +++ b/answers/exercise19.sql @@ -0,0 +1,2 @@ +DELETE FROM Students +WHERE Country = 'Scotland'; \ No newline at end of file diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..e7487f3 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -0,0 +1 @@ +DROP DATABASE myNewDB; \ No newline at end of file diff --git a/answers/exercise20.sql b/answers/exercise20.sql index e69de29..5c66fd1 100644 --- a/answers/exercise20.sql +++ b/answers/exercise20.sql @@ -0,0 +1 @@ +DELETE FROM Students; \ No newline at end of file diff --git a/answers/exercise3.sql b/answers/exercise3.sql index e69de29..669514f 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1,7 @@ +CREATE TABLE Users( +UserID int NOT NULL AUTO_INCREMENT, +LastName varchar(255) NOT NULL, +firstName varchar(255), +address varchar(255), +city varchar(255) +); \ No newline at end of file diff --git a/answers/exercise4.sql b/answers/exercise4.sql index e69de29..fe6a7f5 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -0,0 +1 @@ +DROP TABLE Users; \ No newline at end of file diff --git a/answers/exercise5.sql b/answers/exercise5.sql index e69de29..12321ad 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -0,0 +1 @@ +TRUNCATE TABLE Users; \ No newline at end of file diff --git a/answers/exercise6.sql b/answers/exercise6.sql index e69de29..aa3e9d7 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,3 @@ +ALTER TABLE Users( +ADD Birtday DATE +); \ No newline at end of file diff --git a/answers/exercise7.sql b/answers/exercise7.sql index e69de29..b0e8666 100644 --- a/answers/exercise7.sql +++ b/answers/exercise7.sql @@ -0,0 +1,2 @@ +ALTER TABLE Users +DROP COLUMN Birthday; \ No newline at end of file diff --git a/answers/exercise8.sql b/answers/exercise8.sql index e69de29..75590c0 100644 --- a/answers/exercise8.sql +++ b/answers/exercise8.sql @@ -0,0 +1,2 @@ +INSERT INTO Students +VALUES ('Jane Doe', '57 Union St', 'Glasgow', 'G13RB', 'Scotland'); \ No newline at end of file diff --git a/answers/exercise9.sql b/answers/exercise9.sql index e69de29..681e8b3 100644 --- a/answers/exercise9.sql +++ b/answers/exercise9.sql @@ -0,0 +1,2 @@ +SELECT * FROM Students +WHERE NOT City = 'Philadelphia'; \ No newline at end of file