Re: Heirarchical Data Structures. MS Access. Together?
Date: 28 Jul 2003 12:46:26 -0700
Message-ID: <6dae7e65.0307281146.114a865b_at_posting.google.com>
Heinz Huber <hhuber_at_racon-linz.at> wrote in message news:<3f252d63$0$48902$91cee783_at_newsreader02.highway.telekom.at>...
> Lennart Jonsson wrote:
> > "Jace Harker" <jharker_at_marlboro.edu> wrote in message news:<vhuhvgjqr27d83_at_corp.supernews.com>...
> >
> >>"--CELKO--" <71062.1056_at_compuserve.com> wrote in message
> >>news:c0d87ec0.0307220645.2ccab82f_at_posting.google.com...
> >
> >
[...]
>
> In the "pure" nested set, any parent has (right - left - 1) / 2 = number
> of children.
> Therefore it's easy to find out whether there are any children.
>
Yes, but it is still a bit of a hazzle to make the database understand when it should allow removal of an emp(?).
CREATE TABLE OrgChart (
emp CHAR(10) NOT NULL PRIMARY KEY, boss CHAR(10) NOT NULL, foreign key (boss) references OrgChart on delete restrict
);
should be enough to prevent the situation. Using nested set I assume one would have to use triggers or some similar construct to prevent the same thing. Perhaps one could express it using a check constraint? Without given it too much thought, I assume the constraint would contain a select statement, last time I checked DB2 did not support that, perhaps other databases does?
Regards,
/Lennart
-- the above email no longer works due to spam. values'lennart'||CHR(46)||'jonsson'||CHR(64)||'enlight'||CHR(46)||'net'Received on Mon Jul 28 2003 - 21:46:26 CEST