From a697528fa90580f55fb4803e7b083f0652a2a056 Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 11:08:25 -0400 Subject: [PATCH 1/7] Part1 completed --- SQL SCRIPTS/Part1.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 SQL SCRIPTS/Part1.sql diff --git a/SQL SCRIPTS/Part1.sql b/SQL SCRIPTS/Part1.sql new file mode 100644 index 0000000..8a2513d --- /dev/null +++ b/SQL SCRIPTS/Part1.sql @@ -0,0 +1,5 @@ +Select cus.customerName As Customer_Name, concat(emp.lastName, ',', emp.firstName) As "lastName, firstName" + from classicmodels.customers cus Inner Join classicmodels.employees emp + on cus.salesRepEmployeeNumber=emp.employeeNumber order by 1; + + From 56728934e20e3ab68cd8d36dca8eb9fb225c1a69 Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 11:17:59 -0400 Subject: [PATCH 2/7] Updated Part1 --- SQL SCRIPTS/Part1.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQL SCRIPTS/Part1.sql b/SQL SCRIPTS/Part1.sql index 8a2513d..0c09b8e 100644 --- a/SQL SCRIPTS/Part1.sql +++ b/SQL SCRIPTS/Part1.sql @@ -1,4 +1,4 @@ -Select cus.customerName As Customer_Name, concat(emp.lastName, ',', emp.firstName) As "lastName, firstName" +Select cus.customerName As Customer_Name, concat(emp.lastName, ',', emp.firstName) As Sales_Rep from classicmodels.customers cus Inner Join classicmodels.employees emp on cus.salesRepEmployeeNumber=emp.employeeNumber order by 1; From 5bbb621bb891e89c7f949da7f9d8ecddc62d001b Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 18:17:31 -0400 Subject: [PATCH 3/7] Part2 completed --- SQL SCRIPTS/Part2.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 SQL SCRIPTS/Part2.sql diff --git a/SQL SCRIPTS/Part2.sql b/SQL SCRIPTS/Part2.sql new file mode 100644 index 0000000..98f3b83 --- /dev/null +++ b/SQL SCRIPTS/Part2.sql @@ -0,0 +1,7 @@ + + +Select quantityOrdered Total_Ordered, priceEach, productName Product_Name, +quantityOrdered*priceEach As Total_Sale + from classicmodels.orderdetails join classicmodels.products On orderdetails.productCode=products.productCode + order by 4 Desc + From ba24146bb0ee1fcc8558b8c4c0470430664c4e33 Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 18:29:14 -0400 Subject: [PATCH 4/7] Part3 completed --- SQL SCRIPTS/Part3.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 SQL SCRIPTS/Part3.sql diff --git a/SQL SCRIPTS/Part3.sql b/SQL SCRIPTS/Part3.sql new file mode 100644 index 0000000..52909db --- /dev/null +++ b/SQL SCRIPTS/Part3.sql @@ -0,0 +1,2 @@ +Select count(orderNumber) Orders, status Order_Status from classicmodels.orders +group by status order by status Asc \ No newline at end of file From 66adf90dcfe6f96779d4741d165a6a78c1fefa01 Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 18:50:54 -0400 Subject: [PATCH 5/7] Part4 completed --- SQL SCRIPTS/Part4.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 SQL SCRIPTS/Part4.sql diff --git a/SQL SCRIPTS/Part4.sql b/SQL SCRIPTS/Part4.sql new file mode 100644 index 0000000..0718028 --- /dev/null +++ b/SQL SCRIPTS/Part4.sql @@ -0,0 +1,4 @@ +Select pro1.productLine product_Line, count(pro2.productName) Sold from classicmodels.productlines pro1 + Join classicmodels.products pro2 + On pro1.productLine=pro2.productLine + group by product_Line order by 2 Desc; \ No newline at end of file From 9ef6d38b402407d3b631bb344a1214837181eca7 Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 19:27:04 -0400 Subject: [PATCH 6/7] Part5 completed --- SQL SCRIPTS/Part5.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 SQL SCRIPTS/Part5.sql diff --git a/SQL SCRIPTS/Part5.sql b/SQL SCRIPTS/Part5.sql new file mode 100644 index 0000000..51ffd82 --- /dev/null +++ b/SQL SCRIPTS/Part5.sql @@ -0,0 +1,6 @@ +Select concat(employees.lastname, ',', employees.firstname) Sales_Rep, quantityOrdered Orders, +priceeach*quantityOrdered Total_Sales from classicmodels.customers join classicmodels.employees +on classicmodels.customers.salesRepEmployeeNumber=classicmodels.employees.employeeNumber + join classicmodels.orders on classicmodels.customers.customerNumber=classicmodels.orders.customerNumber + join classicmodels.orderdetails on classicmodels.orders.orderNumber = classicmodels.orderdetails.ordernumber + order by 3 Desc; From 96711a2894f279037b195667107c680ced98f6f5 Mon Sep 17 00:00:00 2001 From: ANIL CHADDHA Date: Mon, 13 Jul 2020 19:47:24 -0400 Subject: [PATCH 7/7] Part6 completed --- SQL SCRIPTS/Part6..sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 SQL SCRIPTS/Part6..sql diff --git a/SQL SCRIPTS/Part6..sql b/SQL SCRIPTS/Part6..sql new file mode 100644 index 0000000..3bfb63c --- /dev/null +++ b/SQL SCRIPTS/Part6..sql @@ -0,0 +1,4 @@ +Select MONTHNAME(orderDate) Month, Extract(YEAR FROM orderDate) Year, + format(ord2.priceEach*ord2.quantityOrdered, 2) Payment_Received + from classicmodels.orders ord1 join classicmodels.orderdetails ord2 +on ord1.orderNumber=ord2.orderNumber \ No newline at end of file