![]() | |
#1
| |||
| |||
|
|
So Coupons may or may not be redeemed so there may be CouponID appearing in rvOrders that have no entry in rvRedemptions. Now it seems to me that 1) conceptually to me rvOrders:CouponID is a foreign key to rvRedemptions |
|
Or is a foreign key constraint a synonym for a referential integrity constraint? |
#2
| |||
| |||
|
|
I prefer the term "inclusion dependency": projection of one relation (that is rvRedemptions v [CouponID]) is a supepersetset of projection of the other (i.e. rvOrders v [CouponID]). I thought that all three terms are the same; perhaps with foreign key constraint adding some insignificant matter, like the "smaller" set being unique. |
#3
| |||
| |||
|
|
(Since I first saw Codd's 1970 paper I've never been able to understand why on the one hand he talked about "symmetrical" access but on the other he used the very restrictive term "foreign key".) *For me, a "reference" is a reference even if most dbms' have similar restrictions to Codd's term. |

|
It seems arbitrary and unnecessarily doctrinaire to restrict references to only primary keys and unique indexes because I think if one wants a particular constraint, one should not have specify two constraints, eg., a 'reference' as well as a key or index. *This doesn't prevent a language from offering shortcuts that are understood to involve both.) |
#4
| |||
| |||
|
|
I think the later talk about domains and e-relations in RM/T (and to a lesser extent in RM/V2) makes that a bit easier to understand. As I interpret it, Codd started with a very clean and purely syntactic model in his seminal article, which will definitely lead to pure symmetry in access. But from the very start he also worried deeply about the semantics and making them explicit as metadata, which leads to the second influential discovery of his: the integral, reflective data dictionary. Later on his development of the relational model not only added surrounding functionality (which weighs in so heavily in RM/ V2, what with all of'em T-joins and the lot) but semantics as well. ... |
#5
| |||
| |||
|
|
I prefer the term "inclusion dependency": projection of one relation (that is rvRedemptions v [CouponID]) is a supepersetset of projection of the other (i.e. rvOrders v [CouponID]). I thought that all three terms are the same; perhaps with foreign key constraint adding some insignificant matter, like the "smaller" set being unique. BTW, one limitation of foreign keys which I find particularly annoying is that they only work when we're talking about base tables whereas I've already bumped a few times into a situation where I would have liked to constrain (on) the contents of a view. That sometimes happens when you have to go beyond 3NF or you're working with a conceptual model which allows multiple inheritance and/or union types. Do you happen to know whether this sort of thing is formally covered by the concept of inclusion dependency? |
#6
| |||
| |||
|
|
On Oct 21, 12:18 pm, Sampo Syreeni <de... (AT) iki (DOT) fi> wrote: I prefer the term "inclusion dependency": projection of one relation (that is rvRedemptions v [CouponID]) is a supepersetset of projection of the other (i.e. rvOrders v [CouponID]). I thought that all three terms are the same; perhaps with foreign key constraint adding some insignificant matter, like the "smaller" set being unique. BTW, one limitation of foreign keys which I find particularly annoying is that they only work when we're talking about base tables whereas I've already bumped a few times into a situation where I would have liked to constrain (on) the contents of a view. That sometimes happens when you have to go beyond 3NF or you're working with a conceptual model which allows multiple inheritance and/or union types. Do you happen to know whether this sort of thing is formally covered by the concept of inclusion dependency? I'm guessing this is just a limitation of some particular products? Because if I'm understanding "The Principle of Interchangeability" that for example Date's discusses in "Databases In Depth" then the RM has nothing to say about the arbitrary distinction between base versus virtual relvars (views). So in principle one should be able to define constraints on any relvars base or otherwise at least in so far as the RM is concerned. Is this correct? KHD |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Thanks to everyone. I think I understand more clearly now the inherent asymmetry of foreign key constraints. But now then my question is what is the common name for the semantic constraint that "attribute RV1:X and RV2:Y are sematincally joinable"? |
|
Because simply having the same type is not enough for example both OrderID and CouponID might both have type GenericID and yet we may want to state that it doesn't make sense to join them. |
|
Likewise attribute names for joinable attributes may be different in different relations (ie needing rename). |
#9
| |||
| |||
|
|
Thanks to everyone. I think I understand more clearly now the inherent asymmetry of foreign key constraints. But now then my question is what is the common name for the semantic constraint that "attribute RV1:X and RV2:Y are sematincally joinable"? Because simply having the same type is not enough for example both OrderID and CouponID might both have type GenericID and yet we may want to state that it doesn't make sense to join them. Likewise attribute names for joinable attributes may be different in different relations (ie needing rename). |
#10
| |||
| |||
|
|
Thanks to everyone. I think I understand more clearly now the inherent asymmetry of foreign key constraints. But now then my question is what is the common name for the semantic constraint that "attribute RV1:X and RV2:Y are sematincally joinable"? Because simply having the same type is not enough for example both OrderID and CouponID might both have type GenericID and yet we may want to state that it doesn't make sense to join them. Likewise attribute names for joinable attributes may be different in different relations (ie needing rename). In other words suppose we go with Mr. Scott's reformulation but with some additional type information (name : type) and attribute name changes in Redemptions for argument sake Orders { OrderID : GenericID } Coupons { OrderID : GenericID , CouponID : GenericID } Redemptions { CID : GenericID , OID : GenericID } where CID is the redeemed coupon's ID and OID is the ID of the order on which the coupon was redeemed (not the order the coupon was shipped with). So as above, we cannot tell it is ok to join CID with CouponID from the attribute name, since they are different, nor can we assume they can be joined simply because they are both type of GenericID because for example so is OID which is not appropriate to join. So if we wanted to express the additional constraint that is semantically appropriate to join CouponID with CID what kind of constraint would this be? Likewise if we wanted to express it is semantically inappropriate to join OrderID and CID? |
|
By the way, Mr. Scott, I removed O# from your R because it seemed redundant to me since we can recover the OrderID of the order the coupon was shipped with from the Orders relation (if we assume that CouponID is a candidate key of Coupons). Is that not correct? |
|
Thanks again for the help! KHD |
![]() |
| Thread Tools | |
| Display Modes | |
| |