• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the relationship?

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Customer 0..1 ------ 0..* Address
This syntax always confuses me.
This is bidirectional ? "0...1" what is meaning, why has "0" there?
Anybody can help me? Thanks.
Edward
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion,
This is a bidirectional. and
0..1 is means Customer may be have Adddress more than one or not have address)
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Customer 0..1 ------ 0..* Address
means that
  • One customer might have several addresses (private, professional, etc) or none at all
  • One address usually belongs to at most one customer (i.e., it is not possible for two different customers to live at the same address)


  • This relationship is debatable as several people can live at the same address. For instance, each member of a family can be a customer and they all live at the same address. The above relationship would not be appropriate for modeling such a case. Instead, the following one can be used:
    Customer 0..* ------ 0..* Address
    There are two more things we could consider here. First, it is usually the case that a customer necessarly has an address without which it could not have been registered as a customer. In order to consider this, the relationship would have to be modeled as follows:
    Customer 0..* ------ 1..* Address
    or
    Customer 0..* ------ + Address
    The second thing is that it doesn't make much sense too have an address in a database that does not belong to at least one customer. Why would a retail store keep an address in its database from which no booking will ever come? Building on this, we can refactor the relationship to the following:
    Customer 1..* ------ + Address
    or
    Customer + ------ + Address
    The relationship now reads:
  • One customer has at least one address
  • One address usually belongs to at least one customer (i.e., two different customers may live at the same address)


  • [ March 08, 2004: Message edited by: Valentin Crettaz ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic