| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: constraints in algebra instead of calculus
"paul c" <toledobythesea_at_oohay.ac> wrote in message
news:nmq4i.205308$aG1.145355_at_pd7urf3no...
> Brian Selzer wrote:
>> "paul c" <toledobythesea_at_oohay.ac> wrote in message
>> news:JQ94i.200044$DE1.108062_at_pd7urf2no...
>>
>>>Brian Selzer wrote:
>>>
>>>>"paul c" <toledobythesea_at_oohay.ac> wrote in message
>>>>news:dX84i.201343$6m4.74192_at_pd7urf1no...
>>>>
>>>>
>>>>>Marshall wrote:
>>>>>
>>>>>
>>>>>>Okay, a while back we were talking about writing constraints
>>>>>>in a language with aspects of the relational calculus, specifically
>>>>>>the existential and universal quantifiers. The point was made
>>>>>>that that's unnecessary; the calculus is no more expressive
>>>>>>than the algebra.
>>>>>>
>>>>>>So it ought to be possible to write any constraint from the
>>>>>>calculus in the algebra.
>>>>>>
>>>>>>Well, I'm having a hard time figuring out how to do it. Can
>>>>>>anyone help?
>>>>>>
>>>>>>How does one write a functional dependency in the algebra?
>>>>>>A foreign key?
>>>>>>
>>>>>>
>>>>>>Marshall
>>>>>>
>>>>>
>>>>>I thought that one was easy, if FK is the set of 'foreign key'
>>>>>attributes and A is the 'referencing table' and using an op like D&D
>>>>><AND>, then it's something like A{FK} <AND> B{FK} = A{FK}. (I like
>>>>>this one because it's particularly easy to implement.)
>>>>>
>>>>
>>>>
>>>>Very slick. One point, though. The constraint
>>>>
>>>>A{FK} <AND> B{FK} = A{FK}
>>>>
>>>>Is not sufficient. Also required is the constraint
>>>>
>>>>COUNT(B{FK}) = COUNT(B)
>>>>
>>>>
>>>>
>>>>
>>>
>>>I've never seen anybody justify why a foreign key must be a candidate key
>>>in the referenced relation/relvar/table except for 'so-and-so says so'.
>>>Whereas I've seen examples where the non-key reference is essential.
>>
>>
>> There is a paper by Mark Levene and Millist W. Vincent, "Justification
>> for Inclusion Dependency Normal Form." In it they argue that a database
>> schema should be free of circular inclusion dependencies and should only
>> contain key-based inclusion dependencies (which are as far as I can tell
>> from their definition, foreign key constraints)
>> ...
>
They talk about avoiding attribute redundancy, preventing update anomalies, and avoiding interactions between FDs and INDs because the joint implication problem for FDs and INDs is undecidable--at least where the set of INDs is circular. The paper is not long, but they pack a lot of information in it. I don't think I can rehash their argument here without making hash of it:) I found it out on the Internet a few years ago. I can't remember where.
>> An inclusion dependency that is not also a foreign key constraint denotes >> a many-to-many relationship, ... >
>
I agree, but it's easier when visualizing a directed graph between values participating in an inclusion dependency to count the arrows originating from values in the referencing relation. If all of the values have only one arrow, then it's a foreign key constraint, whereas if any of the values has more than one arrow, then it's not. Also, when considering the set of INDs in isolation, it makes sense to fold in the effect of that second constraint in order to differentiate between INDs that denote a many-to-many relationship and INDs that denote a one-to-many relationship.
> Here is a quote from my possibly inaccurate echo of Darwen's example that
> I sent in a another thread:
>
>
>
>
>
>
>
F2 references a superkey. The constraint, COUNT(B[FK]) = COUNT(B), requires only that the projection B[FK] be a superkey of B, not necessarily a candidate key. This sqares with SQL, which requires that a unique constraint has been defined on the referenced columns.
V is not in BCNF: since StaffId --> CourseId in Teaches, StaffId --> CourseId in V.
F1 does reference a key: since StaffId --> CourseId, {StudentId, StaffId} is a candidate key for V.
> Sorry for the long post about something so basic, but no apology for
> talking about basics!
>
> p
Received on Mon May 21 2007 - 21:32:18 CDT
![]() |
![]() |