next up previous
Next: Modifying the Database Up: Query-by-Example (QBE) Previous: Ordering the Display of

Aggregate Operations

  1. QBE includes the aggregate operators AVG, MAX, MIN, SUM and CNT. As QBE eliminates duplicates by default, they must have ALL. appended to them.
  2. To find the total balance of all accounts belonging to Jones:

    tabular232

  3. All aggregate operators must have ALL. appended, so to override the ALL.\ we must add UNQ. (unique). (NOTE: a number of examples in the text incorrectly show UNQ. replacing ALL.)

    tabular240

  4. To compute functions on groups, we use the G. operator. To find the average balance at each branch:

    tabular248

  5. To find the average balances at only branches where the average is more than $1,200, we add the condition box:

    tabular256

  6. To find all customers who have an account at all branches located in Burnaby, we can do:

    tabular260

    tabular268

    tabular275



Osmar Zaiane
Tue Jun 9 14:17:04 PDT 1998