Table of Contents## Running Sums

### Solution

Entire Site

The computation of *running sums* is
a common operation. To illustrate, consider Table 19-1, which contains
the duration (in hours, say) for various events.

For each event, we want to compute the sum of all the durations of the events that precede that event. This sum is a running sum.

One approach is to use the Cartesian product of the table with itself. In this way, we can access all records whose Event number precedes that of a given record. For instance, for the record with Event number 5, we need access to the records with Event numbers 1 through 4. The Cartesian product provides us with these records.