Note that this restriction also exists in SQL, and is
implicit in the meaning of aggregation. The only non-aggregated
attributes that are meaningful in the SELECT list are attributes that
appear in the GROUP BY list. As an example, consider a query
with no GROUP BY attributes. It can only produce one output row
per epoch, which contains aggregate values computed from all the
input rows. It is not meaningful to ask for a raw attribute in the
output of such a query - there can be multiple values for each
attribute in the input, so there is no well-specified unique value to
place in the single output column. The same restriction applies in a
GROUP BY query, with the exception of the columns in the GROUP BY
expression - these columns are guaranteed to have a
single unique value per group, and hence can appear alongside aggregate
expressions.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.