Re: How to prevent updates on foreign key default values

From: Steve Kass <skass_at_drew.edu>
Date: Sun, 7 Oct 2001 17:10:09 -0400
Message-ID: <9pqgfu$ma0$1_at_nntp9.atl.mindspring.net>


This is a different question. You could rename school to allschool, but only allow users to modify schools through this updateable view:

CREATE VIEW school AS
SELECT schoolid, schoolname
FROM allschool
WHERE schoolid <> 1

Steve Kass
Drew University

"Christoffer Vig" <chrde_at_online.no> wrote in message news:ud73zxjho.fsf_at_online.no...
> On Sun, 7 Oct 2001, richdillon_at_mindspring.com wrote:
> > Christoffer,
> >
> > The problem here is that, by your business definition, the
> > relationship between students and schools is optional -- a student
> > may be entered without a school. Yet you are defining the
> > relationship in the database as required and this is forcing the
> > workaround of adding a bogus entry into the schools table (which
> > might be better named "schools_and_misc_codes" as a result).
> >
>
> Yes. You are right. That is how I should have modeled this
> relationship. You have also made likely the fact that you are a human
> being by being able to identify 'NOT REGISTERED' as not a proper kind
> of school. Additional evidence is provided through your solution being
> based on the specific example I gave rather than on my general
> problem. For things would have been different if my preferred default
> was 'OKLAHOMA PRISON SCHOOL'. How can I ensure that this value is not
> changed?
>
> Christoffer
>
>
>
Received on Sun Oct 07 2001 - 23:10:09 CEST

Original text of this message