Re: Multiple parent design
From: --CELKO-- <joe.celko_at_northface.edu>
Date: 17 Apr 2004 07:51:04 -0700
Message-ID: <a264e7ea.0404170651.4e38f00b_at_posting.google.com>
Date: 17 Apr 2004 07:51:04 -0700
Message-ID: <a264e7ea.0404170651.4e38f00b_at_posting.google.com>
Etc.
CREATE TABLE Children
(child_id INTEGER NOT NULL PRIMARY KEY,
parent_id INTEGER NOT NULL,
parent_type INTEGER NOT NULL
CHECK(parent_type IN (1,2, ..)),
UNIQUE(parent_id, parent_type),
..);
This requires that each child has one and only one parent in one and only one parent table. No child can be deleted while he has a parent. Received on Sat Apr 17 2004 - 16:51:04 CEST