Last active
October 29, 2015 01:16
-
-
Save townie/312a7134a9deb678389b to your computer and use it in GitHub Desktop.
ds_bos_mysql_tutorial_Keith_and_Pam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ds_bos_mysql_tutorial_Keith_and_Pam | |
What customers are from the UK | |
What is the name of the customer who has the most orders? | |
What supplier has the highest average product price? | |
What category has the most orders? | |
5. What employee made the most sales (by number of sales)? | |
** 6. What employee made the most sales (by value of sales)? | |
** 7. What Employees have BS degrees? (Hint: Look at LIKE operator) | |
** 8. What supplier has the highest average product price assuming they have at least 2 products (Hint: Look at the HAVING operator) |
- What Employees have BS degrees? (Hint: Look at LIKE operator)
SELECT FirstName,LastName,Notes LIKE '% BS %' FROM Employees
What supplier has the highest average product price assuming they have at least 2 products (Hint: Look at the HAVING operator)
SELECT Suppliers.SupplierName, AVG(Products.Price) FROM Suppliers
JOIN Products ON(Suppliers.SupplierID = Products.SupplierID)
JOIN OrderDetails ON(OrderDetails.ProductID = Products.ProductID)
GROUP BY Suppliers.SupplierID HAVING COUNT(OrderDetails.ProductID) > 2
ORDER BY AVG(Products.Price) DESC
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What category has the most orders?