Re: Is it Possible to Enforce This Relationship at the DB Level?
Date: Mon, 15 Oct 2007 21:59:06 -0000
Message-ID: <1192485546.341415.304580_at_q3g2000prf.googlegroups.com>
On Oct 15, 2:00 pm, "David Portas"
<REMOVE_BEFORE_REPLYING_dpor..._at_acm.org> wrote:
> "dutone" <dut..._at_hotmail.com> wrote in message
>
> news:1192479211.800346.53530_at_i38g2000prf.googlegroups.com...
>
>
>
> > DB layout is as follows:
>
> > --------------------------------
> > | Client |
> > --------------------------------
> > 1
> > |
> > |
> > 0..*
> > -------------------------------
> > | Service |
> > -------------------------------
> > 1
> > |
> > |
> > 1
> > ---------------------------------
> > ---------------------------
> > | Spreadsheet Config | 1 ------ 1..* | Cell Config |
> > --------------------------------
> > ---------------------------
> > 1 1
> > | |
> > | |
> > 1 |
> > -------------------------------- |
> > | Spec | |
> > -------------------------------- |
> > 1 |
> > | |
> > | |
> > 1..* |
> > -------------------------------- |
> > | Field |
> > 1----------------------------|
> > --------------------------------
>
> > Every client has a spreadsheet that must implement a version of Spec.
> > For this version, the cell config must corresponding to cells in the
> > spreadsheet containing fields for the given Spec.
>
> > As long a Cell Config references a Fileld, th DB will be happy, but
> > the problem I have is making sure that the Fields referenced by Cell
> > Config are indeed children of the Spec referenced by Spreadsheet
> > Config.
>
> > Is it possible to enforce this at a DB level? Maybe my model is
> > flawed?
>
> > Thanks
>
> In principle it is possible, assuming your DBMS supports something like
> SQL's CREATE ASSERTION statement for example.
I'd like to enforce this based on the data model and its
relationships.
Although to me, it doesn't seem possible without an additional layer
of logic.
The need for a check assertion in a RDMS tells me that cerain
cituations must be enforced at a higher level. This is one of them I
guess.
Thanks Received on Mon Oct 15 2007 - 23:59:06 CEST