Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any Suggestion on Cyclic Entity Relationship?!
Message
 
À
23/03/1998 09:42:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00085989
Message ID:
00086495
Vues:
38
                          Spprice>-----------+Item
              _____________\/   +              +
             /                   \________     |
            +                             /\  /|\
     Customer +-------< Orders +-------< Chooseitem
Justok,

The above shows a relational design failure. The failure is that this E-R diagram is showing unrelated items as being related. Ok to simplify the situation you have;

Customers
Orders
OrderLines
Items
ItemPrices

ItemPrices are associated with Items and Customers in order to esatablish a price for an orderline, but once the price for the orderline is set the relationship to the price table no longer exists, be cause the price for that line on that order for that customer is frozen adn stoired in teh Order Line table. To really diagram this situation you need to use two diagrams, one for the price lookup and one for the Order relationship.

The price lookup diagram is;
         Customer                 Item
            1                       1
            |--------- | -----------|
            |          1            |
            ------n Price n----------
This represents that for any one customer there may be many prices, adn for any one item there may be many prices, however for one customer and one item there should be one price.

The second diagram is for the relationship of customers and orders;
                     Customers
                         |
                         V
                      Orders
                         |
                         V
                    OrderLines <-------Items
The cyclic relationship is gone because we are not looking at the price table at all when looking at orders. The price information is stored in the OrderLine table as the Price set for this line on this order.

This is a situation where what may initially look like redundant data (storing the price in the price table and in the orderline table) is in fact NOT redundant but absolutely required. Think about it, we have a customer Joe and he buys an item X for $1.00 today. We create the order but the price is kept in the price table only. 1 month from now the price of X goes up to 2.00 for Joe, he hasn't paid the old bill yet. We print him a new copy of the bill and it shows 2.00 as the price which is not what the price was when he bought the item.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform