Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added part1/Screenshot Part1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions part1/part1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT customers.customerName,
CONCAT (employees.lastName, ', ', employees.firstName) AS "Sales Rep"
FROM customers
INNER JOIN employees
ON customers.salesRepEmployeeNumber=employees.employeeNumber
ORDER BY customerName ASC;
Binary file added part2/Screenshot Part2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions part2/part2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT p.productName, od.quantityOrdered AS "Total # Ordered", od.quantityOrdered * od.priceEach AS "Total Sale"
FROM products p JOIN orderdetails od
ON p.productCode=od.productCode
ORDER BY od.quantityOrdered * od.priceEach DESC;
Binary file added part3/Screenshot Part3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions part3/part3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT STATUS AS "Order Status" , COUNT(orderNumber) AS "# Orders"
FROM orders
GROUP BY STATUS
ORDER BY STATUS ASC;
Binary file added part4/Screenshot Part4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions part4/part4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT productLine, COUNT(quantityOrdered) AS "# Sold"
FROM products JOIN productlines USING(productLine)
JOIN orderdetails USING(productCode)
GROUP BY productLine
ORDER BY 2 DESC;
Binary file added part5/Screenshot Part5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions part5/part5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SELECT CONCAT(e.lastName, ", ", e.firstName) AS "Sales Rep",
COUNT(o.orderNumber) AS "# Orders", SUM(IFNULL(od.quantityOrdered * od.priceEach, 0)) AS "Total Sales"
FROM employees e LEFT JOIN customers c ON e.employeeNumber=c.salesRepEmployeeNumber
LEFT JOIN orders o ON o.customerNumber=c.customerNumber
LEFT JOIN orderdetails od ON od.orderNumber=o.orderNumber
WHERE e.jobTitle="Sales Rep"
GROUP BY 1
ORDER BY 3 DESC;
Binary file added part6/Screenshot Part6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions part6/part6.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT MONTHNAME(paymentDate) AS "Month", YEAR(paymentDate) AS "Year",
ROUND(amount, 2) AS "Payments Received"
FROM payments