Aggregate Operations



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

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:



Page created and maintained by Osmar R. Zaï ane
Last Update: Mon Oct 16 16:41:58 PDT 1995