Re: Foreign keys

From: Brian Selzer <>
Date: Wed, 16 Jan 2008 01:11:22 -0500
Message-ID: <fehjj.158$>

"Kira Yamato" <> wrote in message news:2008011600092016807-kirakun_at_earthlinknet...
> On 2008-01-15 22:05:24 -0500, "Brian Selzer" <>
> said:
>> "Kira Yamato" <> wrote in message
>> news:2008011514331750073-kirakun_at_earthlinknet...
>>> On 2008-01-15 14:16:32 -0500, "Brian Selzer" <>
>>> said:
>>>> "Kira Yamato" <> wrote in message
>>>> news:2008011512561916807-kirakun_at_earthlinknet...
>>>>> On 2008-01-15 11:51:43 -0500, "Brian Selzer"
>>>>> <>
>>>>> said:
>>>>>> "Kira Yamato" <> wrote in message
>>>>>> news:2008011510320716807-kirakun_at_earthlinknet...
>>>>>>> On 2008-01-15 04:37:23 -0500, "Brian Selzer"
>>>>>>> <>
>>>>>>> said:
>>>>>>>> "Kira Yamato" <> wrote in message
>>>>>>>> news:2008011502240916807-kirakun_at_earthlinknet...
>>>>>>>>> On 2008-01-14 21:18:57 -0500, "Evan Keel" <>
>>>>>>>>> said:
>>>>>>>>>> [...]
>>>> What if
>>>> both the determinant and the dependent draw their values from the same
>>>> domain? For example, EmployeeId --> ManagerId, since managers are also
>>>> employees.
>>> What about it? How does that require surjectivity on the domain of
>>> PartNo?
>>> Conceivably, the domain of PartNo would include all possible integers.
>>> But the relation will not necessarily have all tuples where *every*
>>> possible values of PartNo are in some tuple of the relation.
>> I think you're confusing what is possible and what is actual. What is
>> represented by the domains and the intension of a database specifies
>> /what
>> can be/, but due to the domain closure assumption, what is represented by
>> values in the extension of a database states /what is/. A functional
>> dependency does not limit the possible values in each domain: it instead
>> controls which combinations of values are possible. Lets take that one
>> step
>> further, a functional dependency A --> B does not directly limit the
>> possible values for A or for B; instead it limits the possible
>> combinations
>> of values for A and B.
> So, a functional dependency does not limit the possible values in each
> domain. Ok.
> Rather, it limits the possible combinations of A x B. Ok.
>> Since A --> B only limits AB combinations, then for
>> each value for B there must be at least one value for A, otherwise there
>> wouldn't be an AB combination, would there?
> I still don't see the surjectivity requirement.
> In mathematics, a function is not necessarily surjective. For example,
> let R be the set of real numbers. Then the function
> f : R --> R
> defined by
> f(x) = x^2
> is not a surjective function because f(x) can never be a negative number.
> In relational algebra, say I have a relation Person(Name, Age). Then
> there is functional dependency
> Name --> Age.
> Now, the domain for Age can be any non-negative integer. However, the
> extensional relation will not have a tuple for every possible value of
> Age.

The functional dependency does not affect the set of all possible values for Age; it controls the possible combinations of values for Name and Age. If there is only one tuple with Name 'Brian' in the database, then the functional dependency would hold no matter what the value for Age is. The dependency holds, or is satisfied, so long as there aren't two tuples with the same Name but different Ages.

> Are you saying that Name --> Age is not a functional dependency because it
> is not surjective?

No. What I'm saying is that not only is it the case that for every Name in the extension there is one and only one Age, but also that whenever there is an Age in the extension, there must also be a Name. This is due to the fact that Name and Age appear in the same relation schema. So in that sense Name --> Age /is/ surjective.

I keep wanting to mention active domains, and for a database with a single relation, it would be valid to say that Name --> Age describes a surjection between the active domain for Name and the active domain for Age, but for databases with multiple relations, an active domain is the set of all values from a domain that are in any relation in the database.

> --
> -kira
Received on Wed Jan 16 2008 - 07:11:22 CET

Original text of this message