diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..15102fb Binary files /dev/null and b/.DS_Store differ 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..e79bbe7 100644 --- a/answers/exercise10.sql +++ b/answers/exercise10.sql @@ -0,0 +1,3 @@ +SELECT * +FROM Students +WHERE City LIKE 'Philadelphia' OR 'Trenton'; \ No newline at end of file diff --git a/answers/exercise11.sql b/answers/exercise11.sql index e69de29..4f5564e 100644 --- a/answers/exercise11.sql +++ b/answers/exercise11.sql @@ -0,0 +1,3 @@ +SELECT * +FROM Students +ORDER BY City ASC; \ No newline at end of file diff --git a/answers/exercise12.sql b/answers/exercise12.sql index e69de29..b7744ca 100644 --- a/answers/exercise12.sql +++ b/answers/exercise12.sql @@ -0,0 +1,3 @@ +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..d1cb759 100644 --- a/answers/exercise13.sql +++ b/answers/exercise13.sql @@ -0,0 +1,3 @@ +SELECT * +FROM Students +ORDER BY Country, City ASC; \ No newline at end of file diff --git a/answers/exercise14.sql b/answers/exercise14.sql index e69de29..b76e9a6 100644 --- a/answers/exercise14.sql +++ b/answers/exercise14.sql @@ -0,0 +1,3 @@ +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..5fe4fdb 100644 --- a/answers/exercise15.sql +++ b/answers/exercise15.sql @@ -0,0 +1,3 @@ +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..ee79129 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..c2f0f11 100644 --- a/answers/exercise17.sql +++ b/answers/exercise17.sql @@ -0,0 +1,3 @@ +UPDATE Students +SET City = 'Edinburgh' +WHERE City LIKE 'Scotland'; \ No newline at end of file diff --git a/answers/exercise18.sql b/answers/exercise18.sql index e69de29..a390fbf 100644 --- a/answers/exercise18.sql +++ b/answers/exercise18.sql @@ -0,0 +1,4 @@ +UPDATE Students +SET City = 'Edinburgh', + Country = 'Scotland' +WHERE id = 35; \ No newline at end of file diff --git a/answers/exercise19.sql b/answers/exercise19.sql index e69de29..7c56939 100644 --- a/answers/exercise19.sql +++ b/answers/exercise19.sql @@ -0,0 +1,2 @@ +DELETE FROM Students +WHERE Country LIKE '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..2cf4b34 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1,7 @@ +CREATE TABLE Users ( + UserID INT, + LastName VARCHAR(255), + 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..86d56d9 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,2 @@ +ALTER TABLE Users + ADD Birthday DATE; \ No newline at end of file diff --git a/answers/exercise7.sql b/answers/exercise7.sql index e69de29..c26a8c5 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..b8b5611 100644 --- a/answers/exercise8.sql +++ b/answers/exercise8.sql @@ -0,0 +1,2 @@ +INSERT INTO Students (StudentName, Address, City, PostalCode, Country) + VALUES ('Jane Doe', '57 Union St', 'Glasgow, Scotland', 'G13RB'); \ No newline at end of file diff --git a/answers/exercise9.sql b/answers/exercise9.sql index e69de29..9edece6 100644 --- a/answers/exercise9.sql +++ b/answers/exercise9.sql @@ -0,0 +1,3 @@ +SELECT * +FROM Students +WHERE City NOT LIKE 'Philadelphia'; \ No newline at end of file