From 595d21c732257fca489d9bf864b7e58dc68eabf1 Mon Sep 17 00:00:00 2001 From: monicadeshmukh Date: Wed, 8 Jul 2020 13:54:32 -0400 Subject: [PATCH 1/6] part1.sql --- part1.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 part1.sql diff --git a/part1.sql b/part1.sql new file mode 100644 index 0000000..dc5096f --- /dev/null +++ b/part1.sql @@ -0,0 +1,3 @@ +SELECT productName AS "Name", productLine AS "Product Line", buyPrice AS "Buy Price" +FROM products +ORDER BY buyPrice DESC; \ No newline at end of file From 9b3cd139798549344875e3b5c53fa7504005c577 Mon Sep 17 00:00:00 2001 From: monicadeshmukh Date: Wed, 8 Jul 2020 14:07:33 -0400 Subject: [PATCH 2/6] part2.sql --- part2.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 part2.sql diff --git a/part2.sql b/part2.sql new file mode 100644 index 0000000..f67d210 --- /dev/null +++ b/part2.sql @@ -0,0 +1,8 @@ +/*Write a query to display the first name, last name, and city for all customers from Germany. +Columns should display as First Name, Last Name, and City. +The output should be sorted by the customer’s last name (ascending).*/ + +SELECT contactFirstName AS "First Name", contactLastName AS "Last Name", city AS "City" +FROM customers +WHERE country = "Germany" +ORDER BY contactLastName ASC; \ No newline at end of file From fd8256a3be90bce68dd05801ea15cd2083faacfc Mon Sep 17 00:00:00 2001 From: monicadeshmukh Date: Wed, 8 Jul 2020 14:12:05 -0400 Subject: [PATCH 3/6] part3.sql --- part3.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 part3.sql diff --git a/part3.sql b/part3.sql new file mode 100644 index 0000000..de92478 --- /dev/null +++ b/part3.sql @@ -0,0 +1,8 @@ +/*Write a query to display each of the unique values of the status field in the orders table. +The output should be sorted alphabetically increasing. +Hint: the output should show exactly 6 rows.*/ + +SELECT status +FROM orders +GROUP BY STATUS +ORDER BY STATUS ASC; \ No newline at end of file From 5e06eef8307fa234c3bca41d56d69fb0ffcba960 Mon Sep 17 00:00:00 2001 From: monicadeshmukh Date: Wed, 8 Jul 2020 14:18:35 -0400 Subject: [PATCH 4/6] part4.sql --- part4.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 part4.sql diff --git a/part4.sql b/part4.sql new file mode 100644 index 0000000..62e0cbf --- /dev/null +++ b/part4.sql @@ -0,0 +1,7 @@ +/*Part 4 +Select all fields from the payments table for payments made on or after January 1, 2005. +Output should be sorted by increasing payment date.*/ +SELECT * +FROM payments +WHERE paymentDate >= "2005-01-01" +ORDER BY paymentDate ASC; \ No newline at end of file From bfa74d9c2295708ec945781ac4dd1091c6dac6f6 Mon Sep 17 00:00:00 2001 From: monicadeshmukh Date: Wed, 8 Jul 2020 14:29:51 -0400 Subject: [PATCH 5/6] part5.sql --- part5.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 part5.sql diff --git a/part5.sql b/part5.sql new file mode 100644 index 0000000..5975e28 --- /dev/null +++ b/part5.sql @@ -0,0 +1,10 @@ +/*Part 5 +Write a query to display all Last Name, First Name, Email and Job Title of all employees working out of the San Francisco office. +Output should be sorted by last name.*/ + +SELECT e.lastName AS "Last Name", e.firstName AS "First Name", e.email AS "Email", e.jobTitle AS "Job Title" +FROM employees e +INNER JOIN offices o +ON e.officeCode = o.officeCode +AND o.city = "San Francisco"; + From 506241eaa0abe714e508d05f226a6d6a62ed3c72 Mon Sep 17 00:00:00 2001 From: monicadeshmukh Date: Wed, 8 Jul 2020 15:18:52 -0400 Subject: [PATCH 6/6] part6.sql --- part6.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 part6.sql diff --git a/part6.sql b/part6.sql new file mode 100644 index 0000000..62d4a43 --- /dev/null +++ b/part6.sql @@ -0,0 +1,9 @@ +/*Part 6 +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 productName AS "Name", productLine AS "Product Line", +productScale AS "Scale", productVendor AS "Vendor" +FROM products +WHERE productLine IN ("Vintage Cars", "Classic Cars") +ORDER BY productLine DESC, productName ASC; \ No newline at end of file