title: finding average dollar amount of an order
body: <p>I am trying to find the average dollar amount of an order. I have calculated the average order Total but I need an average that takes into account the fact that not all Orders have a corresponding OrderItems.</p>
  
  <p>This is a homework question and it is as follows:</p>
  
  <blockquote>
    <p>What is the average $$ value of an order? To get the answer, you need
    to add up all the order values and divide this by the
    number of orders.  There are two possible averages on this question,
    because not all of the order numbers in the ORDERS table are in the
    ORDERITEMS table... You will calculate and display both averages.</p>
  </blockquote>
  
  <p>I have writtern the one ignoring orders with no OrderItem, but not sure of how to go about the second case. </p>
  
  <pre><code>    SELECT SUM(OrderItems.qty*INVENTORY.price)  / COUNT(*) AS dollarValue
      FROM Orders, OrderItems, Inventory
      WHERE ORDERS.orderid = OrderItems.orderid AND OrderItems.partid = Inventory.partid 
  </code></pre>
  
  <p><a href="http://dl.dropboxusercontent.com/u/55587776/pictures/SalesDB.jpg" rel="nofollow noreferrer">Link To DB Diagram</a><img src="https://i.stack.imgur.com/tCw7F.jpg" alt="enter image description here"></p>