All Collections
Database Designing
Many-to-many relationships
Many-to-many relationships

Creating and working with m:m relationships

S
Written by Serge Gershkovich
Updated over a week ago

Many-to-many relationships between two entities hold a special challenge for database designers because there is no practical way to construct them physically without a third (linking) table.

Take the classic example of students attending classes. To be a student, one must attend at least one class, and for a class to exist, it must have at least one student enrolled.

Logical representation of a mandatory many-to-many relationship.

Physical representation of a mandatory many-to-many relationship.

To allow users to simultaneously work in and toggle between physical and logical view modes, SqlDBM has settled on a hybrid notation style, using Crow’s foot cardinality and borrowing the relationship diamond from Chen notation, which doubles as a physical table.

Logical representation of a mandatory many-to-many relationship in SqlDBM.

Creating a many-to-many relationship

To create a many-to-many relationship, select it as the connection type from the top menu. The resulting “diamond” symbol on the linking table can be turned on or off from the table properties (for any table).

Existing tables can also be designated as linking tables from the table properties in the Logical view mode. Tick the "Is many-to-many" checkbox on the table properties to designate it as a linking table.

Although any table can be designated as a linking table, not all of them meet the logical requirements. In such a case, warnings will be displayed to notify the user.

Displaying a many-to-many relationship

It is also possible to display many-to-many relationships as diamonds in the Physical view mode.

In the Diagram Properties panel on the right, enable the "Show many-to-many as diamond" checkbox in the View Mode Options.

See also:

Did this answer your question?