CPSC340A
Database Systems

Activity 7

Aggregate Functions

Sales Orders Database

  1. What is the average retail price of a mountain bike?

    +-------------+
    | AverageCost |
    +-------------+
    | 1321.250000 |
    +-------------+
    (1 row)
  2. What was the date of our most recent order?

    +---------------------+
    | MostRecentOrderDate |
    +---------------------+
    | 2013-02-28          |
    +---------------------+
    (1 row)
  3. What was the total amount for order number 8?

    +------------------+
    | TotalOrderAmount |
    +------------------+
    |          1492.60 |
    +------------------+
    (1 row)

Bowling League Database

  1. What is the largest handicap held by any bowler at the current time?

    +--------------+
    | HighHandicap |
    +--------------+
    |           52 |
    +--------------+
    (1 row)
  2. Which locations hosted tournaments on the earliest tournament date?

    +-------------------+
    | TourneyLocation   |
    +-------------------+
    | Red Rooster Lanes |
    +-------------------+
    (1 row)
  3. What is the last tournament date we have in our schedule?

    +----------------+
    | MostRecentDate |
    +----------------+
    | 2013-08-16     |
    +----------------+
    (1 row)