NorthwindQueries AnswersTo7and9
NorthwindQueries AnswersTo7and9
Name:
Paste the SQL statements for the queries below the query statements.
1. OutOfStockProducts: Make a list of products that are out of stock. (My query
yielded 5 records.)
3. ReorderProducts: Make a list of products that need to be re-ordered i.e. where the
units in stock and the units on order is less than the reorder level. (My query
yielded 2 records.)
4. ProductPopularity: Make a list of products and the number of orders in which the
product appears. Put the most frequently ordered item at the top of the list and so
on to the least frequently ordered item. (My query yielded 77 records; Raclette
Courdavault was at the top and Mishi Kobe Niku was at the bottom.)
7. CustomerOrders: Make a complete list of customers, the OrderID and date of any
orders they have made. Include customers who have not placed any orders. (My
query yielded 832 records.)
Add the Customer and Order Tables to your query. Select the CustomerName, OrderID
and OrderDate fields. Right click on the relationship line (diagonal part) and choose Join
Properties.
Ordinarily one does a “natural join” which only keeps entity occurrences actually
participating in the relationship. In order to keep customers who have not placed orders,
select the join from the choices available in the Join Properties dialog box.
8. CustomerNumberOfOrders: Make a complete list of customers along with the
number of orders they have placed. (My query yielded 91 records.)
Instead of adding a table to begin designing a query, we can begin by adding a previous
query.
Use the previous order-counting query to find the maximum count.