From 5921187eacf183f30cc3d14a88225ccb74160ae1 Mon Sep 17 00:00:00 2001 From: CJ Fulton Date: Mon, 13 Jul 2020 09:48:11 -0400 Subject: [PATCH 1/6] Part1 completed --- part1.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 part1.sql diff --git a/part1.sql b/part1.sql new file mode 100644 index 0000000..ae178b8 --- /dev/null +++ b/part1.sql @@ -0,0 +1,6 @@ +SELECT concat(firstName,' ', lastName) AS 'Sales Rep', employeeNumber, salesRepEmployeeNumber, customerName +FROM employees, customers +WHERE employeeNumber = salesRepEmployeeNumber +ORDER BY customerName + + From 88f303eb6483195897663d2efa72dba7d3e0190b Mon Sep 17 00:00:00 2001 From: CJ Fulton Date: Mon, 13 Jul 2020 10:21:34 -0400 Subject: [PATCH 2/6] Completed part 2 --- part2.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 part2.sql diff --git a/part2.sql b/part2.sql new file mode 100644 index 0000000..16370f2 --- /dev/null +++ b/part2.sql @@ -0,0 +1,5 @@ +SELECT SUM(quantityOrdered)*SUM(priceEach) AS 'Total Sale', productName AS 'Product Name', SUM(quantityOrdered) AS 'Total # Ordered' +FROM orderdetails, products +WHERE products.productCode = orderdetails.productCode +GROUP BY orderdetails.productCode +ORDER BY SUM(quantityOrdered)*SUM(priceEach) DESC; From fc6ac07c962def06df9ced71969e765f30ed5673 Mon Sep 17 00:00:00 2001 From: CJ Fulton Date: Mon, 13 Jul 2020 10:26:35 -0400 Subject: [PATCH 3/6] Completed part 3 --- part3.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 part3.sql diff --git a/part3.sql b/part3.sql new file mode 100644 index 0000000..b33f5a3 --- /dev/null +++ b/part3.sql @@ -0,0 +1,4 @@ +SELECT status AS 'Order Status', COUNT(status) AS '# Orders' +FROM orders +GROUP BY status; + From c7ff896133f11a9d36aa9dcb2dccf59dd674aef0 Mon Sep 17 00:00:00 2001 From: CJ Fulton Date: Mon, 13 Jul 2020 10:47:49 -0400 Subject: [PATCH 4/6] Completed part 4 --- part4.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 part4.sql diff --git a/part4.sql b/part4.sql new file mode 100644 index 0000000..a92e235 --- /dev/null +++ b/part4.sql @@ -0,0 +1,5 @@ +SELECT productLine AS 'Product Line' ,COUNT(quantityOrdered) As '# Sold' +FROM products, orderdetails +WHERE products.productCode = orderdetails.productCode +GROUP BY productLine +ORDER By COUNT(quantityOrdered) DESC; From 3169da5418b68bd5db34bab1579e19cfda634385 Mon Sep 17 00:00:00 2001 From: CJ Fulton Date: Mon, 13 Jul 2020 11:56:50 -0400 Subject: [PATCH 5/6] Completed part 6 --- part6.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 part6.sql diff --git a/part6.sql b/part6.sql new file mode 100644 index 0000000..fce08f6 --- /dev/null +++ b/part6.sql @@ -0,0 +1,4 @@ +SELECT MONTH(paymentDate) AS Month, YEAR(paymentDate) AS Year, SUM(amount) AS 'Payments Recieved' +FROM payments +GROUP by Month +ORDER BY Year, Month; From d2758a333c423c73a7ec239d2555a8e05c51ddc3 Mon Sep 17 00:00:00 2001 From: CJ Fulton Date: Mon, 13 Jul 2020 12:10:46 -0400 Subject: [PATCH 6/6] Completed part 5 --- part5.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 part5.sql diff --git a/part5.sql b/part5.sql new file mode 100644 index 0000000..1c3f8ea --- /dev/null +++ b/part5.sql @@ -0,0 +1,5 @@ +SELECT concat (lastName,',',firstName) AS 'Sales Rep', COUNT(quantityOrdered) AS 'Total # Ordered', COUNT(quantityOrdered)*SUM(priceEach) AS 'Total Sales' +FROM employees,customers,orderdetails, orders +WHERE customers.salesRepEmployeeNumber = employees.employeeNumber and orders.orderNumber = orderdetails.orderNumber AND employees.jobTitle = 'Sales Rep' +GROUP BY employeeNumber +ORDER BY COUNT(quantityOrdered)*SUM(priceEach) DESC;