Você está na página 1de 3

Difference between Degree and Cardinality

Degree:-
The degree of a relation is the number of attributes in its header, or, in other words, the number
of columns. It is also used for tuples or records, in which case it refers to the number of fields.
Degree of relationship is divide into three type.
1.Unary Relationships
In the case of the unary relationship shown in the following Figure an employee within the
employee entity is the manager for one or more employees within that entity. In this case, the
existence of the “manages” relationship means that employee requires another employee to be
the manager that is,employee has a relationship with itself. Such a relationship is known as a
recursive relationship.

2.Binary Relationships
A binary relationship exists when two entities are associated in a relationship. Binary
relationships are most common. In fact, to simplify the conceptual design, whenever possible,
most higher-order (ternary and higher) relationships are decomposed into appropriate equivalent
binary relationships. For example the relationship “a professor teaches one or more classes”
represents a binary relationship.

3.Ternary and Higher-Degree Relationships


Although most relationships are binary, the use of ternary and higher-order relationships does
allow the designer some latitude regarding the semantics of a problem. A ternary relationship
implies an association among three different entities. For example, note the relationships (and
their consequences) in the following Figure which are represented by the following business
rules:
A doctor writes one or more precriptions.
A pateint may receive one or more prescriptions.
A drug may appear in one or more prescriptions. (To simplify this example, assume that the
business rule states that each prescription contains only one drug. In short, if a doctor prescribes
more than one drug, a separate prescription must be written for each drug.
Cardinality:-
In the context of databases, cardinality refers to the uniqueness of data values contained in a
column. High cardinality means that the column contains a large percentage of totally unique
values. Low cardinality means that the column contains a lot of “repeats” in its data range.
The degrees of relationship (Cardinality) is explained in the below diagram:

1. One-to-one (1:1): This is where an occurrence of an entity relates to just one occurrence
in another entity. A one-to-one relationship seldom exists in practice, but it can.
However, you will contemplate combining them into one entity.

For example:
An employee is allotted an organization vehicle, which might solely be driven by that employee.
Therefore, there’s a one-to-one relationship between employee and company vehicle.

2. One-to-many (1: M): In this relationship, one occurrence of an entity relates to many
occurrences in another entity.

For example:
Taking the employee and department entities, an employee works in one department however a
department has several employees. Therefore, there’s a one-to-many relationship between
department and employee.

3. Many-to-many: This is where several occurrences in an entity relate to several


occurrences in another entity. The standardization method mentioned earlier would stop
any such relationships but the definition is enclosed here for completeness. Like one-to-
one relationships, many-to-many relationships seldom exist. Usually, they occur because
an entity has been lost.
4. For example:
This many-to-many relationship can be seen between project and employee. An employee works
on many projects and at the same time, a project has several employees.
Difference :

 Some placed degree is defined as The degree of a relationship type concerns the number
of entities within each entity type that can be linked by a given relationship type.
 Cardinality is minimum and maximum number of entity occurrence associated with one
occurrence of the related entity
 Degree. This is the number of entities involved in the relationship and it is usually 2
(binary relationship) however unary and higher degree relationships can be exists.
 Cardinality. This specifies the number of each entity that is involved in the relationship
there are 3 types of cardinality for binary relationship
1.one to one (1:1)
2.one to many (1:n)
3.many to many (n:m)
Cardinality of a table (relation) - Number of records in a table
Cardinality of a column (attribute) - Number of unique values stored in that attribute
Degree of a table (relation) - Number of attributes in a table

Degree of a Relation - Number of attributes in a relation


Cardinality of a Relation - Number of tuples in a relation
They both are not same, but they are bit similar.

Você também pode gostar