Databases Reference
In-Depth Information
Or equivalently:
S := S MINUS ( S WHERE CITY = 'London' ) ;
As with all assignments, what happens here is that (a) the source expression on the right
side is evaluated and then (b) the value resulting from that evaluation is assigned to the target
variable on the left side, with the overall effect already explained.
So DELETE is shorthand for a certain relational assignment—and, of course, an analogous
remark applies to INSERT and UPDATE also: They too are basically just shorthand for certain
relational assignments. Logically speaking, in fact, relational assignment is the only update
operator we really need (a point I'll elaborate on in the next section).
To sum up: There's a logical difference between relation values and relation variables.
For that reason, I'll distinguish very carefully between the two from this point forward—I'll talk
in terms of relation values when I mean relation values and relation variables when I mean
relation variables. However, I'll also abbreviate relation value, most of the time, to just relation
(exactly as we abbreviate integer value most of the time to just integer ). And I'll abbreviate
relation variable most of the time to relvar ; for example, I'll say the suppliers-and-parts
database contains three relvars (more specifically, three “real” or base relvars, so called to
distinguish them from “virtual” relvars or views).
Base Relvar Definitions
Here for purposes of subsequent reference are Tutorial D definitions for the three base relvars in
our running example:
VAR S BASE RELATION
{ SNO CHAR , SNAME CHAR , STATUS INTEGER , CITY CHAR }
KEY { SNO } ;
VAR P BASE RELATION
{ PNO CHAR , PNAME CHAR , COLOR CHAR , WEIGHT RATIONAL , CITY CHAR }
KEY { PNO } ;
VAR SP BASE RELATION
{ SNO CHAR , PNO CHAR , QTY INTEGER }
KEY { SNO , PNO }
FOREIGN KEY { SNO } REFERENCES S
FOREIGN KEY { PNO } REFERENCES P ;
Note: For the purposes of this topic, I choose to overlook the fact that Tutorial D as currently
defined doesn't actually include any explicit FOREIGN KEY syntax.
 
Search WWH ::




Custom Search