Skip to content
Open

SQL #21

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
5 changes: 5 additions & 0 deletions part1.sql
Original file line number Diff line number Diff line change
@@ -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;
10 changes: 10 additions & 0 deletions part2.sql
Original file line number Diff line number Diff line change
@@ -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;

7 changes: 7 additions & 0 deletions part3.sql
Original file line number Diff line number Diff line change
@@ -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;
Empty file added part4.sql
Empty file.