• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

what is the relationship?

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
     
    Bring me the box labeled "thinking cap" ... and then read this tiny ad:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic