John V
John V

Reputation: 5047

What does this notation mean? (ERD)

I have troubles understanding the notation on the model I was given. I assume it means 1-n (0 included) but I do not understand why - any medication should have a dose, in addition, the keys are not nullable. So how could there be 0?

enter image description here

Upvotes: 2

Views: 3557

Answers (1)

NoChance
NoChance

Reputation: 5752

The notation is Crow's foot notation for Entity Relationship modeling (this is concerned with Entity name, Lines and boxes and names on relationships which are absent here only).

Each tool has it own way of representing some of the aspects of a data model. For example some tools use dashed/dotted lines to represent non-identifying relationship (that is the FK is allowed to change).

The diagram (boxes and lines) tells us:

R1- Each [Dose] is administrated as 0,1,...,N [Medicament(s)]

R2- Each [Medicament] Must have 1 prescribed [Dose]

  • NN means Not Null (this is tool dependent)

  • The primary key for Dose is ID

  • The primary key for Medicament is both [ID] and [ID Dose] (a FK from Dose).

You are correct to assume that the diagram is inconsistent. (NN) Not Nullable indicates Mandatory relationship at the [Medicament] end. Hence the (0) or little circle should not be there.

I have guessed what the relationships are in the above text, I could be wrong. That is why the data modeler should have clarified what they mean exactly otherwise the relationship could be interpreted wrong.

Here is a similar diagram using MySQL Workbench ERD Tool - No little circles or zero is shown with either types of lines:

enter image description here

Edit/Correction

Not being familiar with the specific tool used to represent the diagram, I assumed that both columns are part of a compound key for the child table. However, as the comment below by @KhDonen indicates, this does not have to be the case. Maybe the tool designate FK with a "key" symbol/icon even if it is not part of the PK. In which case, there would only be 1 key on each table and the diagram will be consistent.

Upvotes: 2

Related Questions