## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# IMAGE RELATIONS

An image relation is, loosely, the “image” within some relation of some tuple (usually a tuple within some other relation). For example, given the suppliers-and-parts database and our usual sample values, the following is the image within the shipments relation of the supplier tuple for supplier S4:

 `PNO` `QTY` `P2` `200` `P4` `300` `P5` `400`

Clearly, this particular image relation can be obtained by means of the following Tutorial D expression

`     ( SP WHERE SNO = 'S4' ) { ALL BUT SNO }`

Here’s a formal definition of image relations in general:

Definition: Let relations r1 and r2 be joinable (i.e., such that attributes with the same name are of the same type); let t1 be a tuple of r1; let t2 be a tuple of r2 that has the same values for those common attributes as tuple t1 does; let relation r3 be that restriction of r2 that contains all and only such tuples t2; and let relation r4 be the projection of r3 on all but those common attributes. Then r4 is the image relation (with respect to r2) corresponding to t1.

Here’s an example that illustrates the usefulness of image relations:

`     S WHERE ( !!SP ) { PNO } = P { PNO }`

Explanation:

• First of all, the roles of r1 and r2 from the definition are being played by the suppliers relation and the shipments relation, respectively (where by “the suppliers relation” I mean the current value of relvar S, and similarly for “the shipments relation”).

• Next, observe that the boolean expression in the WHERE clause involves an equality comparison between two relations ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required