Next: Modifying the Database
Up: Query-by-Example (QBE)
Previous: Ordering the Display of
QBE includes the aggregate operators AVG, MAX, MIN, SUM and CNT.
As QBE eliminates duplicates by default, they must have ALL. appended
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:
Tue Jun 9 14:17:04 PDT 1998