Re: Multiple parent tables?

From: James <jraustin1_at_hotmail.com>
Date: 21 Oct 2001 19:18:58 -0700
Message-ID: <a6e74506.0110211818.4086dbaf_at_posting.google.com>


> An Order can contain 0..n Items.
> An Order can contain 0..n Revisions
> A revision is actually made up of 3..4 Items. That is, a Revision has
> inherent data, specifically its date, and contains 3..4 instances of
> data, each identical to an Item, except that the foreign key of the
> items would, in this case, refer to the primary key of the Revision
> instead of to an order.

Assuming Orders and Revisions are similar, you can utilize a self join. The parent would the original order. The children would be the revisions.

T_Order
 OrderId
 OrderIdParent (Self Join)
 CustomerId

T_Item
 OrderId (FK)

An object-oriented solution, utilizing the above concept, can be downloaded from http://www.xdb1.com/Example/Ex044.asp (260KB). XDb is extremely flexible and can model complex/variable data structures.

GM
  .Orders
    Order1

      .OrderDate
      .DeliveryDate
      LaserSystem
        .Cost
        .Price
      Battery
        .Cost
        .Price
      Order1_Rev1
        .OrderDate
        .DeliveryDate
        LaserSystem
          .Cost
          .Price
        Battery
          .Cost
          .Price

XDb is an object-oriented database for Windows & Pocket PCs. Instantiate, reference, cut, copy, paste, delete, query objects. Fast, flexible, compact, orthogonal. Download your free copy from http://www.xdb1.com Received on Mon Oct 22 2001 - 04:18:58 CEST

Original text of this message