From 27dfdce7b5dc96dacc86be4e354f5e64514138ab Mon Sep 17 00:00:00 2001 From: StephSteve Date: Wed, 8 Jul 2020 16:03:45 -0400 Subject: [PATCH 1/3] day 1 SQL --- Day1 Simple Queries/part1.sql | 1 + Day1 Simple Queries/part2.sql | 1 + Day1 Simple Queries/part3.sql | 1 + Day1 Simple Queries/part4.sql | 2 ++ Day1 Simple Queries/part5.sql | 3 +++ Day1 Simple Queries/part6.sql | 3 +++ 6 files changed, 11 insertions(+) create mode 100644 Day1 Simple Queries/part1.sql create mode 100644 Day1 Simple Queries/part2.sql create mode 100644 Day1 Simple Queries/part3.sql create mode 100644 Day1 Simple Queries/part4.sql create mode 100644 Day1 Simple Queries/part5.sql create mode 100644 Day1 Simple Queries/part6.sql diff --git a/Day1 Simple Queries/part1.sql b/Day1 Simple Queries/part1.sql new file mode 100644 index 0000000..7489df6 --- /dev/null +++ b/Day1 Simple Queries/part1.sql @@ -0,0 +1 @@ +SELECT productName, productLine, buyPrice FROM products; \ No newline at end of file diff --git a/Day1 Simple Queries/part2.sql b/Day1 Simple Queries/part2.sql new file mode 100644 index 0000000..ec5cb55 --- /dev/null +++ b/Day1 Simple Queries/part2.sql @@ -0,0 +1 @@ +SELECT contactFirstName, contactLastName, city From customers WHERE(country = 'Germany'); \ No newline at end of file diff --git a/Day1 Simple Queries/part3.sql b/Day1 Simple Queries/part3.sql new file mode 100644 index 0000000..eed3aaa --- /dev/null +++ b/Day1 Simple Queries/part3.sql @@ -0,0 +1 @@ +SELECT DISTINCT status FROM orders; diff --git a/Day1 Simple Queries/part4.sql b/Day1 Simple Queries/part4.sql new file mode 100644 index 0000000..be5d99b --- /dev/null +++ b/Day1 Simple Queries/part4.sql @@ -0,0 +1,2 @@ +/*Select all fields from the payments table for payments made on or after January 1, 2005.*/ +SELECT * FROM payments WHERE paymentDate >= 2005-01-01 ORDER BY paymentDate | ASC; \ No newline at end of file diff --git a/Day1 Simple Queries/part5.sql b/Day1 Simple Queries/part5.sql new file mode 100644 index 0000000..85d72fe --- /dev/null +++ b/Day1 Simple Queries/part5.sql @@ -0,0 +1,3 @@ +/*Write a query to display all Last Name, First Name, Email and Job Title of all employees working out +of the San Francisco office.*/ +SELECT * FROM employees WHERE officeCode =1 ORDER BY lastName; \ No newline at end of file diff --git a/Day1 Simple Queries/part6.sql b/Day1 Simple Queries/part6.sql new file mode 100644 index 0000000..89768c6 --- /dev/null +++ b/Day1 Simple Queries/part6.sql @@ -0,0 +1,3 @@ +/*Write a query to display the Name, Product Line, Scale, and Vendor of all of the car products – +both classic and vintage. The output should display all vintage cars first (sorted alphabetically by name), +and all classic cars last (also sorted alphabetically by name).*/ From c70f26d505d6a7a417dab52771ee0f807d187c7c Mon Sep 17 00:00:00 2001 From: StephSteve Date: Wed, 8 Jul 2020 18:07:21 -0400 Subject: [PATCH 2/3] updates to Simple Queries --- Day1 Simple Queries/part4.sql | 2 +- Day1 Simple Queries/part6.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Day1 Simple Queries/part4.sql b/Day1 Simple Queries/part4.sql index be5d99b..cf8df7f 100644 --- a/Day1 Simple Queries/part4.sql +++ b/Day1 Simple Queries/part4.sql @@ -1,2 +1,2 @@ /*Select all fields from the payments table for payments made on or after January 1, 2005.*/ -SELECT * FROM payments WHERE paymentDate >= 2005-01-01 ORDER BY paymentDate | ASC; \ No newline at end of file +SELECT * FROM payments WHERE paymentDate >= 2005-01-01 ORDER BY paymentDate ASC; \ No newline at end of file diff --git a/Day1 Simple Queries/part6.sql b/Day1 Simple Queries/part6.sql index 89768c6..d63cf65 100644 --- a/Day1 Simple Queries/part6.sql +++ b/Day1 Simple Queries/part6.sql @@ -1,3 +1,4 @@ /*Write a query to display the Name, Product Line, Scale, and Vendor of all of the car products – both classic and vintage. The output should display all vintage cars first (sorted alphabetically by name), and all classic cars last (also sorted alphabetically by name).*/ +SELECT * FROM products WHERE productLine IN ('Classic Cars', 'Vintage Cars') order by productLine DESC; \ No newline at end of file From f112794282b2f8f08f066a6a6312045557804365 Mon Sep 17 00:00:00 2001 From: StephSteve Date: Wed, 8 Jul 2020 19:18:28 -0400 Subject: [PATCH 3/3] more updates --- Day1 Simple Queries/part4.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Day1 Simple Queries/part4.sql b/Day1 Simple Queries/part4.sql index cf8df7f..8aab658 100644 --- a/Day1 Simple Queries/part4.sql +++ b/Day1 Simple Queries/part4.sql @@ -1,2 +1,3 @@ /*Select all fields from the payments table for payments made on or after January 1, 2005.*/ -SELECT * FROM payments WHERE paymentDate >= 2005-01-01 ORDER BY paymentDate ASC; \ No newline at end of file +SELECT * FROM payments WHERE paymentDate BETWEEN '2005-01-01' AND '2020-07-08' + ORDER BY paymentDate ASC; \ No newline at end of file