1

Please have a look at the below diagram image.

enter image description here

That image represents the "One to Many" relationship. It says "Client is introduced by Introducer". Client can have 1 Introducer or non at all, but Intrudcer can have many clients.

So even though it is "Client can have 1 Introducer or non at all", it is still described in ER Diagrams as a one to many relationship right? I am little worried about this "non at all" part, as far as I know "One to many relationship" describes that scenario as well. I am bit confused on this, having a look at diagrams after some time!

PeakGen
  • 21,894
  • 86
  • 261
  • 463

1 Answers1

3

One-to-many relations only states (in your example diagram) that ONE client could have only ONE introducer (this is the ONE part of the One-to-many). (A client could be introduced by only one introducer). The MANY part states that one Introducer could introduce zero, one or any number of clients. A client can contact you without any introduction.

You are right, the one-to-many relationship could be confusing, but is there any relationship if there is no introducer for a client? (No there is no relation).

In the above example, if the Introducer_id column in the Client table is nullable, the relationship is not a requirement, so there could be one or more clients who has no introducer. The relationship could be required, if the foreign key column is not nullable (The NOT NULL constraint is present on the field).

So the relationship and its cardinality is defined by the FOREIGN KEY and the NOT NULL constraints on the 'many' side's columns.

The ER diagram represents the cardinality of the relationship when the relationship actually exists. (How can you represent that there is no relation?)

Pred
  • 8,789
  • 3
  • 26
  • 46
  • awesome answer. `A client can contact you without any introdution` - This is what I exactly wanted to know. `In the above example, if the Introducer_id column in the Client table is nullable, the relationship is not a requirement, so there could be one or more clients who has no introducer.` - Yes it is Nullable. Thanks a lot~ – PeakGen Sep 09 '14 at 14:06
  • `Only one person can introduce a new person` - Introducer can introduce many clients...Not just one.. – PeakGen Sep 09 '14 at 14:08
  • This is bit confusing.. `Only one person can introduce a new person ` -because introducer can have many clients. – PeakGen Sep 09 '14 at 14:09
  • That is true, but one client (new person) could be introduced by one introducer :) I'll edit the answer as soon as possible. (I'm on phone now) – Pred Sep 09 '14 at 14:12