Relationship

The relationship in the ER model is represented using a diamond-shaped box.

Example:

Example of Relationship in DBMS

‘Buys’ is a relationship between customer entity and products. This relationship can be read as ‘A customer buys a product/products.

Therefore, a relationship is a way to connect multiple entities.

  • When a  customer buys a product, there is a timestamp associated with it, so the attribute “Time” will be an attribute of ‘Buys’.
  • All the database concepts can be easily understood from the concepts of sets and relations.
  • According to the Set-theoretic perspective, it will be represented as

Example

By interpreting this, we can understand that many customers can buy the same type of product and many products can be bought by many customers. And there are some products which are not bought by any customer and there are some customers who do not buy any product.

According to the Relation/table perspective or relational model:
It can be represented as  

Many to many Relationship

As the relationship is many to many(M: N) between customer and product, therefore we require separate tables/ relations for ‘buys’. 
In buys relation, Cust_id and Prod_id are the foreign key to the customer and product. 

What is Mapping Cardinalities in ER Diagrams

In a Database Management System (DBMS), mapping cardinalities explains how entities (tables) in a database schema relate to one another. They provide the number of instances of one entity that can be linked to the number of instances of another entity via a certain kind of relationship, such as many-to-many, one-to-one, or many-to-many. Designing exact links between tables, preserving data integrity, and simulating actual business operations in a database all depend on the mapping of cardinalities. They are a cornerstone of database design’s entity-relationship paradigm.
Whenever an attribute of one entity type refers to another entity type, then some relationship exists between them. 

Example:

Example of Mapping Cardinalities

  • The attribute Manager of the department refers to an employee who manages the department.
  • In the ER model, these references are represented as relationships.

Similar Reads

Relationship

The relationship in the ER model is represented using a diamond-shaped box....

Mapping Cardinality/Cardinality Ratio

Mapping cardinality is the maximum number of relationship instances in which an entity can participate....

Conclusion

The number of instances of one entity that can be connected to the number of instances of another object is specified by mapping cardinalities in a database schema, which explain how entities (tables) link to one another. This kind of interaction is essential for preserving data integrity and precisely simulating processes in the real world within a database. By expressing cardinalities as one-to-one, one-to-many, and many-to-many, mapping cardinalities aids in defining the guidelines for data interactions in database management systems (DBMSs)....

Contact Us