Introduction
In a relational database, the number of entity types that participate in a relationship is called the degree of the relationship. The degree of a relationship is represented by an arc between two rectangle symbols. The following illustration shows a one-to-many relationship between the customer and product entity types. In this example, one customer can purchase many products, but each product can only be purchased by one customer.
One-to-many relationships are the most common type of relationship. In a one-to-one relationship, each instance of an entity type can be related to only one instance of another entity type. For example, each employee can have only one job title, and each job title can be assigned to only one employee.
In a many-to-many relationship, each instance of an entity type can be related to zero, one, or more instances of another entity type. For example, each customer can purchase zero, one, or more products; and each product can be purchased by zero, one, or more customers.
What is an Entity Type?
An entity type is a classification of similar objects or concepts, such as customer or product. In a database, an entity type is represented by a table. Each row in the table represents one instance of that entity type (one customer or one product).
What is a Relationship Type?
A relationship type is an assertion about the nature of a relationship between two entity types. In other words, it is a statement that says “such-and-such relationships exist between these entity types.” For example, we might say that there is a “marriage” relationship type between “person” and “person.” By contrast, an attribute is a statement about a single entity type, such as “height” or “weight.”
What is the Cardinality of a Relationship Type?
In database design, the cardinality of a relationship type specifies the number of entity types that participate in the relationship type. The cardinality of a relationship type is usually expressed as a pair of numbers, where the first number represents the minimum number of entity types that can participate in the relationship type, and the second number represents the maximum number. For example, a relationship type with a cardinality of 1:M has a minimum cardinality of 1 and a maximum cardinality of M.
The most common relationship cardinalities are 1:1, 1:M, and M:N.
1:1 – In a one-to-one (1:1) relationship, each entity instance in one entity type is related to exactly one entity instance in the other entity type. An example of a 1:1 relationship is an employee and her job title.
1:M – In a one-to-many (1:M) relationship, each entity instance in one entity type is related to zero, one, or many entity instances in the other entity type. An example of a 1:M relationship is an author and her books.
M:N – In a many-to-many (M:N) relationship, each entity instance in both entity types is related to zero or more instances in the other entity type. An example of an M:N relationship is students and courses.
What is the Modality of a Relationship Type?
The modality of a relationship type specifies the number of entity types that can participate in the relationship type. The number of entity types that participate in a relationship type is called the degree of the relationship type. The modality of a relationship type is thus a positive whole number that is equal to or greater than the degree of the relationship type. The minimum number of entity types that can participate in a relationship type is two, which results in a binary (alsocalled dyadic) relationship type. A relationships whose modality is two is called a binary relationships. A relationship whose modality is three is called a ternary relationships. A relationships whose modality is four or more is called an n-ary relationships, where n represents the modality of the relationship type
Conclusion
In computer science, the number of entity types that participate in a relationship is called the degree of the relationship. The degree of a relationship is determined by the number of participating entity types. In other words, if a relationship between two entity types is considered to be a binary relationship, then its degree would be two. If a relationship among three entity types is considered to be a ternary relationship, then its degree would be three.