2

Scenario

In my system, there are a number of different TradeBaskets. Each TradeBasket contains a number of different Securities. The Securities have a Type, Value, Sector etc... and new Securities are populated into the basket each day (and others can be removed).

Each TradeBasket has a unqiue list of EligibleEquity that can be accepted from the Securities within the TradeBasket. EligibleEquity can take the form of CommonStock, PfdStock, Reit, MutualFunds etc. My initial approach was to model the EligibleEquities as a multivalued attribute (instead of an entity). But I believe the best approach is to model EligibleEquity as an entity.

The TradeBasket also has a list of EligibleIndices that are accepted for the EligibleEquities in the TradeBasket. Thus, for each type of EligibleEquity in the TradeBasket, there is a list of associated EligibleIndices. It is true that each type of EligibleEquity(such as CommonStock, PfdStock etc...) can exist in a number of different EligibleIndices (such as S&P500, AS25X, CAC40 etc...) and that each EligibleIndices can be associated with a number of different EligibleEquities. Thus, I have assigned a Many:Many relationship between EligibleEntities and EligibleIndices.

ERD Design ERD Design

In the ERD provided, I have colour coded the relationship between the TradeBasket and EligibleEquities and EligibleIndices.

In one case (red), I have mapped the EligibleEquity and EligibleIndices as a 1:Many relationship with the TradingBasket. In this case, I consider EligibleEquity and EligibleIndices as multi-valued attributes of the TradeBasket. Thus, in order to normalize the TradeBasket, the EligibleEquity and EligibleIndices are placed in separate tables (using the primary key of TradeBasket as the foreign key in each EligibleEquity and EligibleIndices child table). However, is it possible to create a Many:Many relationship between ElibibleEquity and EligibleIndices if they are children to the TradeBasket?

In the other case (purple), I have mapped the EligibleEquity and EligibleIndices as a Many:Many relationship with the TradingBasket. In this case, I consider EligibleEquity and EligibleIndices as entities in their own rite. and the Many:Many relationship between EligibleEquities and EligibleIndices is straightforward.

Questions:

  1. To facilitate a relationship between EligibleEquity and EligibleIndices, what the cardinalities should I adopt (red or purple - with respect to the ERD)?

  2. If the EligibleEquity and EligibleIndices should be mapped as multivalued entities of the TradingBasket, what would the primary key of the "junction" table between EligibleEquity and EligibleIndices be?


This question has a similar discussion, but doesn't fully answer my question.

Thanks for any help!

0

Before I attempt to answer your questions, just a couple of hints that may help you to create the perfect model :-) Bear with me.

  • When you construct an ERD, try and avoid "database" terminology such as: primary key, foreign key, table, row. Instead, use the terms "entity", "relationship", "unique identifier", "instance".

  • Use singular nouns as entity names. When creating an entity, think about a SINGLE instance (of an entity). This may make it easier to find the correct cardinalities.

  • You can draw as many relationships as you like. However, only keep the relationships that make sense in your system (eg if there are 5 entities, and the relationships in your diagram make it look a bit like a pentagram inscribed into a 5-sided polygon, then there are - in all probability - too many relationships). The MANY side of a relationship will eventually be transformed into a foreign key (which we should not worry about when working at the ERD level).

Now to your questions:

Q0) However, is it possible to create a Many:Many relationship between ElibibleEquity and EligibleIndices if they are children to the TradeBasket?

Answer 0) Yes. Just make sure that this really makes sense (see answer 1).

Q1) To facilitate a relationship between EligibleEquity and EligibleIndices, what should the cardinalities should i adopt (red or purple - in relation to the ERD)?

Answer 1) Find out, and use, whatever is correct! Does EACH EligibleEquity (potentially) use/contain ONE OR MORE EquitableIndices? AND: Is EACH EquitableIndex used/contained within ONE OR MORE EquitableEquities? -> If the answer to both of these questions is: YES, then model a many-to-many relationship. (This will require an "intersection" or "junction" later on -> see the HYPOTHETICAL... entity in the attached ERD.)

enter image description here

Q2) If the EligibleEquity and EligibleIndices should be mapped as multivalued entities of the TradingBasket, what would the primary key of the junction table between EligibleEquity and EligibleIndices be?

Answer 2) -> The key for this could be: the combination of the UNIQUE IDENTIFIERs (UIDs) of TradingBasked and EligibleEquity (or EligibleIndex, respectively).

Eg - situation as discussed in "Answer 1": if the UIDs are the attributes(EligibleEquity)TYPE, and (EligibleIndex)INDEX_NAME, respectively, then a combination of these (unique) values can serve as a UID of the intersection/junction. (-> See the keys of the HYPOTHETICAL... table in the attached Relational model.)

enter image description here

There is more to be considered, and I'm sure that there will be more questions. Let us know how you get on!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.