2. (Multiattribute PACK): Let relation r have interval attributes A1, A2, ..., An (n > 1). Then (and only then) the expression PACK r ON (A1, A2, ..., An) denotes the packing of r on A1, A2, ..., An, in that order, and it’s equivalent to the following—
PACK ( ... ( PACK ( PACK r′ ON ( A1 ) ) ON ( A2 ) ) ... ) ON ( An )
—where r′ is the fully unpacked form of r (in other words, r′ is the relation denoted by the expression UNPACK r ON (A1, A2, ..., An)). 3. (Nullary PACK) Let r be a relation. Then (and only then) the expression PACK r ON ( ) denotes the packing of r on no attributes, and it returns relation r itself.
Examples: 1. Let relation r be as follows:
┌─────┬───────────┐│ SNO │ DURING │├═════┼═══════════┤│ S2 │ [d02:d04] ││ S2 │ [d03:d05] ││ S4 │ [d02:d05] ││ S4 │ [d04:d06] ││ S4 │ [d09:d10] │└─────┴───────────┘
Then packing r on DURING yields:
┌─────┬───────────┐│ SNO │ DURING │├═════┼═══════════┤│ S2 │ [d02:d05] ││ S4 │ [d02:d06] ││ S4 │ [d09:d10] │└─────┴───────────┘
2. Let relation r be as follows:
┌─────────┬───────────┐│ A1 │ A2 │├═════════┼═══════════┤│ [P2:P4] │ [d01:d04] ││ [P3:P5] │ [d01:d04] ││ [P2:P4] │ [d05:d06] ││ [P2:P4] │ [d06:d09] │└─────────┴───────────┘
Then packing r on (A1,A2) yields:
┌─────────┬───────────┐│ A1 │ A2 │├═════════┼═══════════┤│ [P2:P5] │ [d01:d04] ││ [P2:P4] │ [d05:d09] │└─────────┴───────────┘
By contrast, packing r on (A2,A1) yields:
┌─────────┬───────────┐│ A1 │ A2 │├═════════┼═════
Get The New Relational Database Dictionary now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.