Skip to content

Latest commit

 

History

History
38 lines (19 loc) · 835 Bytes

File metadata and controls

38 lines (19 loc) · 835 Bytes
 # Given:
    the_order = Order.sample
    the_product = Product.sample

Can you write code to answer each question?

Hint: Each answer can be written with one line of code.

  1. How many customers do we have?

  2. What is the most expensive thing we sell?

  3. What is the subtotal of the_order (cost all items excluding shipping)?

  4. How much does the average customer spend per order?

  5. How many items in the_order cost more than $100?

  6. How many different products were purchased in the_order?

  7. How many times has the_product have been ordered?

  8. How many orders contain the_product?

  9. How many people bought the_product?

Extra Credit: (these might require more than one line of code)

  1. What's the most popular product we sell?

  2. On average, how many items are purchased in a typical order?