Aggregate Operations
Next: Modifying the Database
Up: Query-by-Example (QBE)
Previous: Ordering the Display
-
QBE includes the aggregate operators AVG, MAX, MIN, SUM and CNT.
As QBE eliminates duplicates by default, they must have ALL. appended
to them.
-
To find the total balance of all accounts belonging to Jones:

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

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

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

-
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