Re: Schema Relationship Question

From: Ed Prochak <edprochak_at_gmail.com>
Date: Thu, 04 Oct 2007 21:09:23 -0000
Message-ID: <1191532163.080453.88450_at_22g2000hsm.googlegroups.com>


On Oct 3, 8:15 pm, JOG <j..._at_cs.nott.ac.uk> wrote:
> On Oct 3, 10:44 pm, JamesHoward <James.w.How..._at_gmail.com> wrote:
>
> > I have a set of predefined constants with a set of predefined
> > relationships and am looking for a way to link them if possible to
> > ensure data integrity.
>
> > An example would be if I wanted to keep track of programs and I have a
> > table Programs with rows operating system type and programming
> > language. If both operating system type and programming language are
> > foreign keys to reference tables (just tables with a primary key and a
> > name to the element they are referencing) is there a way to ensure
> > data integrity for possible nonsensical pairings such as programming
> > language c# and operating system unix?
>
> > Thanks in advance,
> > Jim Howard
>
> Well, those non-viable pairings are part of your data. You could have
> an ugly hard coded check constraint, or alternatively create a table
> containing those disallowed pairings, and check select against it on
> any insertion into your programs table. I'd check out the particular
> flavour of RDBMS you are using on google for appropriate syntax. Good
> luck.

better is a table of allowed pairings and a Foreign key constraint (IMHO) Ed Received on Thu Oct 04 2007 - 23:09:23 CEST

Original text of this message