Re: semantics of foreign keys: domain specific inequality?

From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: 31 Dec 2006 01:47:25 -0800
Message-ID: <1167558445.433757.138830_at_i12g2000cwa.googlegroups.com>


falcon wrote:
> I'm trying to figure out how to deal with the relative importance of
> tables involved in a foreign-key relationship. My actual problem is
> one of generating HTML pages directly from database schemas (think of
> ruby-on-rails, django, etc.), and doing it in a way that makes sense
> for non-technical users (when they have the ability to declare the
> database schema).
>
> Consider two sets of tables:
>
> =>school: (school-name, description)
> =>student: (student-name, description, [school-name])
>
> school and student are tables, both have names and descriptions,
> student has a foreign key to school which indicates that each student
> has only one school but a school may have many students.
>
> =>unix-command: (command-name, description)
> =>unix-command-parameter: (parameter-name, description, [command-name])
>
> unix-command and unix-command-parameters are two tables, each has a
> name and a description. unix-command-parameter has a foreign key to
> unix-command which indicates that a command may have many parameters
> but a parameter and its description are associated with only one
> command. (think of "grep" as a command and list of grep parameters and
> descriptions can be obtained by "grep --help")
>
> ---------------
> Both sets of tables have the same basic structure and the exact same
> foreign key relation ship (one-to-many). However, while both 'school'
> and 'student' are important entities seperately,
> 'unix-command-parameter' wouldn't make any sense without
> 'unix-command.'
>

Possibly because [command-name] is part of the key in unix-command-parameter whereas [school-name] is not so in student? Just my guess because you didn't specify any candidate keys.

In ER modelling a foreign key that is a subset of a key in the referencing entity is known as an Identifying Relationship; otherwise Nonidentifying.

-- 
David Portas
Received on Sun Dec 31 2006 - 10:47:25 CET

Original text of this message