0% found this document useful (0 votes)
95 views16 pages

Cardinality and Participation

The document discusses relationship constraints in database management systems, including cardinality constraints and participation constraints. It defines one-to-one, one-to-many, and many-to-many relationships. It also discusses how cardinality refers to both the number of entities participating in a relationship and the uniqueness of values in a database table column. Participation constraints can be total, where every entity participates in at least one relationship, or partial, where only some entities participate.

Uploaded by

Amjad hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views16 pages

Cardinality and Participation

The document discusses relationship constraints in database management systems, including cardinality constraints and participation constraints. It defines one-to-one, one-to-many, and many-to-many relationships. It also discusses how cardinality refers to both the number of entities participating in a relationship and the uniqueness of values in a database table column. Participation constraints can be total, where every entity participates in at least one relationship, or partial, where only some entities participate.

Uploaded by

Amjad hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Cardinality &

Participation
Constraint in DBMS
Relationship Constraints
We can distinguish two main types of relationship constraints:
•Cardinality constraints
•Participation constraint
Requirements for analysis
Requirement Analysis:
•Every employee work for one department
•An department can have many employees
•New department need not have employee

Degree:

In every relationship how many entities are participating.


 
Relationship
Representation
Requirement Analysis

Every Department should have a manager & only one employee manages a department.
An Employee can manage only one department
Relationship
Cardinality
The term cardinality actually has two different meanings depending on the context of
it’s usage – one meaning is in the context of Data modeling and the other meaning is in
the context of SQL statements.
In The Context Of Data Modeling
It simply refers to the relationship that one table can have with another
table

Classification / Degree Of Cardinality

One-to-One (1:1):One occurrence of an entity relates to only


one occurrence in another entity.
One-to-Many (1:M): One occurrence in an entity relates to many
occurrences in another entity.
Many-to-Many (M:N) Many occurrences in an entity relate to
many occurrences in another entity.
Three degrees of Cardinality
One-to-One (1:1):One occurrence of an entity relates to only one occurrence in another
entity.

One-to-Many (1:M): One occurrence in an entity relates to many occurrences in another


entity.

Many-to-Many (M:N) Many occurrences in an entity relate to many occurrences in another


entity.
Requirement Analysis

Employee belongs to the department, some of the employees are new and having no department. An
employee is not belongs to more than one department at the same time.
Employee salary is maintained on monthly basis. Therefore new employee might not have the
salaries for the current month.
Every employee participating in a team. Each employee participate in a single team.

These teams are managed by the employees, an employee can manage the single team.
Cardinality in SQL
Cardinality refers to the uniqueness of data contained in a column. If a column has a lot of duplicate
data (e.g. a column that stores either "true" or "false"),it has low cardinality, but if the values are highly
unique (e.g. Social Security numbers), it has high cardinality
Cardinality in SQL
For example,

let’s say we have a table with a “Gender” column which has only two possible
values of “Male” and “Female”.
Then, that “Gender” column would have a cardinality of 2, because there are only
two unique values that could possibly appear in that column .
Cardinality in SQL
Let’s say that we have a primary key column on a table with 10,000 rows. What do you think the
cardinality of that column would be?

Primary key: It is a key in a relational database that is unique for each record.
Participation Constraint

There are two types of participation constraints—total and partial.

The participation of an entity set E in a relationship set R is said to be total if every


entity in E participates in at least one relationship in R.

If only some entities in E participate in relationships in R, the participation of entity set


E in relationship R is said to be partial. 
 
Participation Constraint (In ER Model)

Double line indicates the total participation constraint in an ER model. 


 

Single line indicates the partial participation constraint in an ER model.

You might also like