Quote:
|
Originally Posted by rbfree
All my texts talk about on delete and update properties for foreign keys. Do they work with primary keys, too?
|
Actually, no foreign keys without primary keys (or at least, "alternate" keys)!
That is, a foreign key on table C refers to a (sort of) primary key in table P.
Otherwise said, a foreign key is a property of a pair of tables, (C,P); it "points" from table C to table P.
(To complicate things even further, tables C and P might even be the same table ;-)
Delete and update properties of a foreign key are thus properties of this "pointer" between the two tables C and P. They will limit some of the allowed actions on one of the tables, or "trigger" additional actions on one of the two tables.
Which actions and what restrictions? That's exactly what the property tells us. E.g., an "update cascade" will have different restrictions and side-effects than a "delete restrict".