0% found this document useful (0 votes)
15 views11 pages

Database Systems

The document discusses different types of structural constraints in database systems including one-to-one, one-to-many, and many-to-many relationships. It provides examples of each type of relationship and explains cardinality and participation constraints.

Uploaded by

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

Database Systems

The document discusses different types of structural constraints in database systems including one-to-one, one-to-many, and many-to-many relationships. It provides examples of each type of relationship and explains cardinality and participation constraints.

Uploaded by

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

Database Systems

Lec# 9
Topics
Structural Constraints:
• One-to-One Relationships
• One-to-Many Relationships
• Many-to-Many Relationships
• Cardinality and Participation Constraints
Cardinality of Relationships
• Cardinality defines maximum number of instances of one entity are related to
instances of another entity in relationship.
• Number of instances of one entity type that can possibly be related to instances of
other entity type
• Types of cardinality
• one-to-one
• one-to-many
• many-to-many

• Symbol of cardinality
• One is represented by vertical line
• Many is represented by crow feet
One to One Relationship
• In it , for each instance in Entity class A, there is only one instance in Entity
class B and for each instance in Entity class B, there is only one instance in
Entity class A.

ud uName uAddr eId


eName

University has VC

cId cName Area pId


pName

Country has President


One to Many Relationship
• In it , for each instance in Entity class A, there are many instances in Entity
class B and for each instance in Entity class B, there is only one instance in
Entity class A.

ud uName uAddr dId


dName

University has Department

cId cName Area cityId


cityName

Country has City


Many to Many Relationship
• In it , for each instance in Entity class A, there are many instances in Entity
class B and for each instance in Entity class B, there are many instances in
Entity class A.

sId sName sPhone cCode


cName

Student Registers Course

aId aName aPhone bID


bName

Author write Book


Types of Cardinalities
One to one
DEPT
Chair
Person

One to many
DEPT EMP

Many to many

EMP PROJ
Cardinality and Participation Constraints
• Participation Constraints
• Participation or minimum cardinality defines minimum number of instances of one entity are
related to instances of another entity in relationship.
• It determines whether the relationship is optional or mandatory
• It represents whether all entity instances are involved in a particular relationship (referred to as
mandatory participation) or only some (referred to as optional participation).
• Optional participation
• is represented as a minimum value of zero 0,

• Represented by 0

• Mandatory participation
• is shown as a minimum value of 1.

• Represented by vertical line |


Examples of Relationships and their cardinalities
• Example 1
• PATIENT Has Recorded PATIENT HISTORY : Each patient has one or more patient
histories. (The initial patient visit is always recorded as an instance of PATIENT HISTORY.) Each
instance of PATIENT HISTORY “belongs to” exactly one PATIENT.
Examples of Relationships and their cardinalities
• Example 2
• EMPLOYEE Is Assigned To PROJECT : Each PROJECT has at least one EMPLOYEE
assigned to it. (Some projects have more than one.) Each EMPLOYEE may or may not be
assigned to any PROJECT or may be assigned to one or more PROJECTs.
Examples of Relationships and their cardinalities
• Example 3
• STUDENT Is Borrowed Book: A student may or may not borrow a book from library and may
borrow many books. A book must be borrowed by only one student at a time and a book may not
be borrowed by any student

Student Borrow Book

Optional Optional

You might also like