From 45c4b7a3ba7c0481bf90be5e157d11723ca2455e Mon Sep 17 00:00:00 2001 From: David Trombello Date: Mon, 25 Nov 2019 20:42:30 -0500 Subject: [PATCH] all questions answered --- answers/exercise1.sql | 1 + answers/exercise10.sql | 2 ++ answers/exercise11.sql | 1 + answers/exercise12.sql | 1 + answers/exercise13.sql | 1 + answers/exercise14.sql | 1 + answers/exercise15.sql | 1 + answers/exercise16.sql | 2 ++ answers/exercise17.sql | 2 ++ answers/exercise18.sql | 4 ++++ answers/exercise19.sql | 1 + answers/exercise2.sql | 1 + answers/exercise20.sql | 1 + answers/exercise3.sql | 6 ++++++ answers/exercise4.sql | 1 + answers/exercise5.sql | 1 + answers/exercise6.sql | 2 ++ answers/exercise7.sql | 2 ++ answers/exercise8.sql | 2 ++ answers/exercise9.sql | 1 + 20 files changed, 34 insertions(+) diff --git a/answers/exercise1.sql b/answers/exercise1.sql index e69de29..87bf400 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..82def03 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..598d940 100644 --- a/answers/exercise11.sql +++ b/answers/exercise11.sql @@ -0,0 +1 @@ +select * from Students order by City; diff --git a/answers/exercise12.sql b/answers/exercise12.sql index e69de29..76e1099 100644 --- a/answers/exercise12.sql +++ b/answers/exercise12.sql @@ -0,0 +1 @@ +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..571e455 100644 --- a/answers/exercise13.sql +++ b/answers/exercise13.sql @@ -0,0 +1 @@ +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..6252ccb 100644 --- a/answers/exercise14.sql +++ b/answers/exercise14.sql @@ -0,0 +1 @@ +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..267e5d9 100644 --- a/answers/exercise15.sql +++ b/answers/exercise15.sql @@ -0,0 +1 @@ +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..8b67e9b 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..221af5f 100644 --- a/answers/exercise17.sql +++ b/answers/exercise17.sql @@ -0,0 +1,2 @@ +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..dbb21b4 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..c726d19 100644 --- a/answers/exercise19.sql +++ b/answers/exercise19.sql @@ -0,0 +1 @@ +delete from students where country = 'Scotland'; \ No newline at end of file diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..fb893a1 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..e9fcbcc 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..dbcd2c9 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1,6 @@ +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..0679c64 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..c55f726 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..8ba5bf8 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,2 @@ +alter table Users + -> add column Birthday Date; \ No newline at end of file diff --git a/answers/exercise7.sql b/answers/exercise7.sql index e69de29..ad4320c 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..23c3e1f 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', 'G13RB','Scotland'); \ No newline at end of file diff --git a/answers/exercise9.sql b/answers/exercise9.sql index e69de29..dcb1fbe 100644 --- a/answers/exercise9.sql +++ b/answers/exercise9.sql @@ -0,0 +1 @@ +select * from Students where City <> 'Philadelhia'; \ No newline at end of file