Chapter Four. Relation Variables


We saw in Chapter 1 that a relation variable (relvar for short) is a variable whose permitted values are relations, and that it's specifically relvars, not relations, that are the target for INSERT, DELETE, and UPDATE operations. We also saw that INSERT, DELETE, and UPDATE are all just shorthand for certain relational assignments. I remind you too that (a) if R is a relvar and r is a relation to be assigned to R, then R and r must be of the same relation type, and (b) the terms heading, body, attribute, tuple, cardinality, and degree, formally defined in Chapter 3 for relations, can all be interpreted in the obvious way to apply to relvars as well. Now it's time to take a closer look at these matters. As a basis for examples, I'll use the following Tutorial D definitions for the base relvars in the suppliers-and-parts database:

     VAR S BASE RELATION       { SNO SNO, SNAME NAME, STATUS INTEGER, CITY CHAR }         KEY { SNO } ;     VAR P BASE RELATION       { PNO PNO, PNAME NAME, COLOR COLOR, WEIGHT WEIGHT, CITY CHAR }         KEY { PNO } ;     VAR SP BASE RELATION       { SNO SNO, PNO PNO, QTY QTY }         KEY { SNO, PNO }         FOREIGN KEY { SNO } REFERENCES S         FOREIGN KEY { PNO } REFERENCES P ;



Database in Depth
Database in Depth: Relational Theory for Practitioners
ISBN: 0596100124
EAN: 2147483647
Year: 2006
Pages: 127
Authors: C.J. Date

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net