Search code examples
sqlrelational-databasediagramerd

SQL Relational model links


Can anyone explain the links between the tables? like sometimes there's a bubble, other times a rectangle appears and so on.

enter image description here


Solution

  • This is an entity-relationship diagram (ERD) using Crow's foot notation. The lines represent relationships between tables. In this variant of the notation, the * identifies the primary key of a table.

    At each end of a relationship, you will find two symbols:

    • closest to the table: a | or 3 lines joining. The first means a cardinality of maximum 1 and the second a cardinality maximum N (i.e. "many").
    • next to the first symbol, either a | or a O : The first means a mandatory participation (i.e. minimum 1) and the second an optional participation (i.e. minimum is 0).

    So, combining the two gives 4 possibilities:

    • enter image description here means "none or 1" (aka 0..1),
    • enter image description here means "1 and exactly 1" (aka 1..1),
    • ![enter image description here means "none, one or many" (aka 0..n), and
    • the last combination, which is not on your diagram, would mean "1 or more" (i.e. 1..n)