@@ -251,8 +251,56 @@ union (Parents relation)
251251
252252##### Group
253253
254+The group operator (not to be confused with SQL's "GROUP BY") creates a sub-relation for the named attributes and collapses the unnamed attributes where the projected tuples are equal. It can be used for aggregate queries whereby the original and aggregate values can be returned. The group operator does not imply any aggregation, but can be used to create one.
255+
256+Examples:
257+
258+* Retrieve and group people who are of the same age.
259+
260+group ("Name") as "SameAgePeople"
261+
262+|(Name, Name Type)|(Age, Age Type)|
263+|-----------------|---------------|
264+|Steve|12|
265+|Cindy|12|
266+|Bob|45|
267+|Tom|12|
268+
269+===>
270+
271+|(SameAgePeople, relation (Name, Name Type)) | (Age, Age Type) |
272+|------------------------------------|-----------------|
273+|<table><tr><th>(Name, Name Type)</th></tr><tr><td>Steve</td></tr><tr><td>Cindy</td></tr><tr><td>Tom</td></tr></table>| 12|
274+|<table><tr><th>(Name, Name Type)</th></tr><tr><td>Bob</td></tr></table>|45|
275+
276+Note that the new type of "SameAgePeople" is relation-based type. This can be thought of as a nested relation within a relation.
277+
254278##### Ungroup
255279
280+Ungroup unwraps a relation-valued attribute into the top-level relation.
281+
282+Examples:
283+
284+* Given the relation containing people's name mapped to their pets' names, create a relation whereby each person's name is mapped directly to each pet name.
285+
286+ungroup ("Pets")
287+
288+|(Name, Name Type)| (Pets, relation (PetName, Name Type))|
289+|-----------------|--------------------------------------|
290+|Cindy|<table><tr><th>(PetName, Name Type)</th></tr><tr><td>Smurfy</td></tr><tr><td>Stretchy</td></tr></table>|
291+|Bob|<table><tr><th>(PetName, Name Type)</th></tr></table>|
292+|Sam|<table><tr><th>(PetName, Name Type)</th></tr><tr><td>Socks</td></tr></table>|
293+
294+===>
295+
296+|(Name, Name Type)|(PetName, Name Type)|
297+|-----------------|--------------------|
298+|Cindy|Smurfy|
299+|Cindy|Stretchy|
300+|Sam|Socks|
301+
302+Note that Bob does not appear in the result relation because he has no pets.
303+
256304### Displaying Relations
257305
258306Note that in the above operator examples, the order of the tuples appears to shift around. Since a relation body is a set of tuples, any ordering, such as required to represent a relation in two-dimenstional space as a table, is completely arbitrary. Note that the following two relations are two representations of *same* relation: