diff --git a/part1.sql b/part1.sql new file mode 100644 index 0000000..0a58daa --- /dev/null +++ b/part1.sql @@ -0,0 +1,5 @@ + +SELECT customers.customerName, employees.lastName, employees.firstName +FROM customers +INNER JOIN employees ON customers.salesRepEmployeeNumber=employees.employeeNumber +ORDER BY customerName ASC; \ No newline at end of file diff --git a/part2.sql b/part2.sql new file mode 100644 index 0000000..ddf1cbf --- /dev/null +++ b/part2.sql @@ -0,0 +1,10 @@ +/*Determine which products are most popular with our customers. +-For each product, list the total quantity ordered along with the total sale + generated (total quantity ordered * priceEach) for that product. +-The column headers should be Product Name, Total # Ordered and Total Sale. +-List the products by Total Sale descending.*/ + +SELECT productName AS 'Product Name',(quantityOrdered * priceEach) AS 'Total sale', quantityOrdered as 'Total # Ordered' +FROM products JOIN orderdetails ON products.productcode=orderdetails.productcode +ORDER BY (quantityOrdered * priceEach) desc; + diff --git a/part3.sql b/part3.sql new file mode 100644 index 0000000..726a20d --- /dev/null +++ b/part3.sql @@ -0,0 +1,7 @@ +/*Write a query which lists order status and the # of orders with that status. +Column headers should be Order Status and # Orders. +Sort alphabetically by status. Recieved help from Lakshmi*/ + +SELECT ORDERS.STATUS AS 'Order Status', COUNT(*) AS '#of Orders' FROM orders +group BY ORDERS.STATUS +ORDER BY orders.STATUS; diff --git a/part4.sql b/part4.sql new file mode 100644 index 0000000..e69de29