Database Reference
In-Depth Information
Aggregate: The aggregate operations are used to summarize (aggregate) the values
of a column of a relation. The standard operators are COUNT, COUNTD, SUM, SUMD,
AVGD, MAX, MIN. COUNT, SUM and AVG return numeric values; MAX and MIN return
alphanumeric or numeric values, depending on the column in question. COUNTD,
SUMD, and AVGD avoid duplicate values for that column. Each operator is specified with
a column (attribute) as follows:
Note: The aggregate operations are typically used in a scenario where data is
grouped.
Grouping: By grouping data from a relation, we can derive summarized information
for the purpose of analysis. Grouping and aggregation usually go together. For the
purpose of discussion, let us assume that the relational algebra syntax for defining a
group is as follows:
where <Attribute List> is simply a list of attributes, with the comma as the separator.
Grouping is normally embedded as part of some larger relational algebra expression.
With the above notation, we can extract summary information from relations as in the
following example.
Example 11: Produce a list showing the academic program and corresponding
number of courses for each program:
 
Search WWH ::




Custom Search