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:


  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.)


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


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


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




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