Relationship
‫ارتباط‬
‫کننده‬ ‫تهیه‬:‫عادل‬ ‫هللا‬ ‫عصمت‬
Topics:
• Relationship
• Degree of a relation
• Associative entity
• Cardinality of relationships
•‫ارتباط‬
•‫ارتباط‬ ‫درجه‬
•‫پذیر‬ ‫شرکت‬ ‫موجودیت‬
•‫ارتباط‬ ‫کاردینالیتی‬
1:50 AM
Gharjistan University Computer Science
Faculty Farah Branch
2
Relationship:
• Showing association among
two or more than two entity
types is called Relationship.
•‫اضا‬ ‫یا‬ ‫و‬ ‫دو‬ ‫بین‬ ‫رابطه‬ ‫دادن‬ ‫نشان‬‫فه‬
‫بنام‬ ‫را‬ ‫موجودیت‬ ‫نوع‬ ‫دو‬ ‫از‬ ‫تر‬
‫میکند‬ ‫یاد‬ ‫ارتباط‬.
Nangarhar University Computer Sceince
Faculty
3
Continue…
Nangarhar University Computer Sceince
Faculty
4
Teacher SubjectTeaches
Degree of a relation:
• The number of entity types
that participate in a
relationship is called its
degree.
•‫یک‬ ‫در‬ ‫که‬ ‫موجودیت‬ ‫نوع‬ ‫تعداد‬
‫درجه‬ ‫بنام‬ ‫میکند‬ ‫شرکت‬ ‫ارتباط‬
‫میشود‬ ‫یاد‬ ‫ارتباط‬.
Nangarhar University Computer Sceince
Faculty
5
Degree of a relation…
• Three most common degree
are:
1. Unary Relationship(Degree
one).
2. Binary Relationship(Degree
two).
3. Ternary
Relationship(degree three).
•‫ذیل‬ ‫قرار‬ ‫معمول‬ ‫بسیار‬ ‫درجه‬ ‫سه‬
‫است‬:
.1‫یگانه‬ ‫ارتباط‬(‫یک‬ ‫درجه‬)
.2‫دوگانه‬ ‫ارتباط‬(‫دو‬ ‫درجه‬)
.3‫گانه‬ ‫سه‬ ‫ارتباط‬(‫سه‬ ‫درجه‬)
Nangarhar University Computer Sceince
Faculty
6
Unary relationship(degree one):
• A relation between the
instances of single entity
type is called Unary(Degree
one) Relationship .
• An entity type linked with
itself, also called recursive
relationship.
•‫ن‬ ‫یک‬ ‫های‬ ‫نمونه‬ ‫بین‬ ‫ارتباط‬ ‫یک‬‫وع‬
‫یاد‬ ‫یگانه‬ ‫ارتباط‬ ‫بنام‬ ‫موجودیت‬
‫میشود‬.
•‫موجودیت‬ ‫نوع‬ ‫یک‬‫خودش‬ ‫با‬ ‫ایکه‬
‫ارتباط‬ ‫بنام‬ ‫همچنان‬ ‫باشد‬ ‫وصل‬
‫میشود‬ ‫یاد‬ ‫بازگشتی‬.
Nangarhar University Computer Sceince
Faculty
7
person
Is_married_to
EMPLOYEE
Manages
Binary relationship(degree two):
• A relation between the
instances of two entity
types is called
binary(degree two)
relationship.
•‫های‬ ‫نمونه‬ ‫بین‬ ‫ارتباط‬ ‫یک‬‫نوع‬ ‫دو‬
‫ارتباط‬ ‫بنام‬ ‫موجودیت‬‫یاد‬ ‫دوگانه‬
‫میشود‬.
Nangarhar University Computer Sceince
Faculty
8
Teacher SubjectTeaches
Ternary relationship(degree three):
• A Relationship between the
instances of three entity
types is called
Ternary(Degree three)
relationship.
• Example: Many venders
ships many items to
many warehouses.
•‫های‬ ‫نمونه‬ ‫بین‬ ‫ارتباط‬ ‫یک‬‫سه‬‫نو‬‫ع‬
‫ارتباط‬ ‫بنام‬ ‫موجودیت‬‫ی‬ ‫گانه‬ ‫سه‬‫اد‬
‫میشود‬.
•‫مثال‬:‫اشیای‬ ‫زیاد‬ ‫گان‬ ‫فروشنده‬
‫انتقال‬ ‫زیاد‬ ‫های‬ ‫گدام‬ ‫به‬ ‫را‬ ‫زیادی‬
‫میدهد‬.
Nangarhar University Computer Sceince
Faculty
9
Ternary relationship(degree three)…
• The Institute might need to
record which teachers
taught which subjects in
which courses.
•‫داشت‬ ‫ضرورت‬ ‫ممکن‬ ‫انستیتیوت‬‫ه‬
‫استا‬ ‫کدام‬ ‫که‬ ‫کند‬ ‫ثبت‬ ‫تا‬ ‫باشد‬‫کدام‬ ‫د‬
‫درس‬ ‫صنف‬ ‫کدام‬ ‫در‬ ‫را‬ ‫مضمون‬
‫میدهد‬.
1:50 AM
Gharjistan University Computer Science
Faculty Farah Branch
10
Degree of relationships:
Nangarhar University Computer Sceince
Faculty 11
Entities of
two different
types related
to each other.
Entities of three
different types
related to each
other.
One entity
related to
another of
the same
entity type.
Associative entity:
• The presence of one or
more attributes on a
relationship suggests to the
designer that the
relationship should perhaps
be represented as an entity
type.
• That entity type is called
associative Entity.
•‫یک‬ ‫از‬ ‫بیشتر‬ ‫یا‬ ‫و‬ ‫یک‬ ‫موجودیت‬
‫ب‬ ‫ارتباط‬ ‫یک‬ ‫باالی‬ ‫خاصه‬ ‫صفت‬‫ه‬
‫ارت‬ ‫که‬ ‫میکند‬ ‫پیشنهاد‬ ‫دیزاینر‬‫به‬ ‫باط‬
‫داده‬ ‫نمایش‬ ‫موجودیت‬ ‫نوع‬ ‫شکل‬
‫شود‬.
•‫بنام‬ ‫موجودیت‬ ‫نوع‬ ‫این‬ ‫که‬
‫میشود‬ ‫یاد‬ ‫پذیر‬ ‫شرکت‬ ‫موجودیت‬.
Nangarhar University Computer Sceince
Faculty
12
Nangarhar University Computer Sceince Faculty
Associative entity example:
Nangarhar University Computer Science
Faculty
13
STUDENT COURSE
Std_id S_name Course_id C_title
Certificate
Date_comp
Certificate_No
Cardinality of relationships:
• One to One:
• Each entity in the
relationship will have
exactly one related entity.
• For example:
•‫یک‬ ‫به‬ ‫یک‬:
•‫یک‬ ً‫ا‬‫دقیق‬ ‫ارتباط‬ ‫در‬ ‫موجودیت‬ ‫هر‬
‫داشت‬ ‫خواهد‬ ‫وابسته‬ ‫موجودیت‬.
•‫مثال‬ ‫بطور‬:
Nangarhar University Computer Sceince
Faculty
14
Person Passporthas
Cardinality of relationships…
• One to Many:
• An entity on one side of the
relationship can have many
related entities, but an
entity on the other side will
have a maximum of one
related entity.
• For example:
•‫چند‬ ‫به‬ ‫یک‬:
•‫ارتباط‬ ‫طرف‬ ‫یک‬ ‫در‬ ‫موجودیت‬ ‫یک‬
‫وابس‬ ‫موجودیت‬ ‫چندین‬ ‫که‬ ‫میتواند‬‫ته‬
‫طرف‬ ‫موجودیت‬ ‫اما‬ ‫باشد‬ ‫داشته‬ ‫را‬
‫وابس‬ ‫موجودیت‬ ‫یک‬ ‫حداکثر‬ ‫دیگر‬‫ته‬
‫داشت‬ ‫خواهد‬.
•‫مثال‬ ‫بطور‬:
Nangarhar University Computer Sceince
Faculty
15
Instructor Coursesteaches
Cardinality of relationships…
• Many to Many:
• Entities on both sides of the
relationship can have many
related entities on the other
side.
•‫چند‬ ‫به‬ ‫چند‬:
•‫طرف‬ ‫دو‬ ‫هر‬ ‫در‬ ‫ها‬ ‫موجودیت‬
‫موجودی‬ ‫چندین‬ ‫که‬ ‫میتواند‬ ‫ارتباط‬‫ت‬
‫باش‬ ‫داشته‬ ‫دیگر‬ ‫طرف‬ ‫در‬ ‫وابسته‬‫د‬.
1:50 AM
Gharjistan University Computer Science
Faculty Farah Branch
16
Student CoursesRegister for
Mandatory/Optional Relationships:
• Participation by an entity in
a relationship may
be optional or mandatory.
• For example:
•‫یک‬ ‫در‬ ‫موجودیت‬ ‫یک‬ ‫شرکت‬
‫اجباری‬ ‫یا‬ ‫و‬ ‫اختیاری‬ ‫ممکن‬ ‫رابطه‬
‫باشد‬.
•‫مثال‬ ‫بطور‬:
Nangarhar University Computer Sceince
Faculty
17
Employee CarDrives
Continue…
1:50 AM
Gharjistan University Computer Science
Faculty Farah Branch
18
Continue…
1:50 AM
Gharjistan University Computer Science
Faculty Farah Branch
19
1:50 AM
Gharjistan University Computer Science
Faculty Farah Branch
20

More Related Content

PPTX
Cardinality and participation constraints
PPTX
CBO Basics: Cardinality
PPT
Unit02 dbms
PDF
Laravel.IO A Use-Case Architecture
PPT
Use Case Modeling
PPTX
How to Draw an Effective ER diagram
PPTX
Revision Lecture
PPT
Lecture 02 terminology of database
Cardinality and participation constraints
CBO Basics: Cardinality
Unit02 dbms
Laravel.IO A Use-Case Architecture
Use Case Modeling
How to Draw an Effective ER diagram
Revision Lecture
Lecture 02 terminology of database

Similar to Relationship in database (20)

PPTX
Database week 6.pptx that inclekdjnd dnfj
PPTX
E_R-Diagram (2).pptx
PDF
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
PPTX
Unit 1 Data Modeling_Updated (2) (2).pptx
PPT
Transactional Research from the Inter/National Coalition for Electronic Portf...
PPTX
DBMS_Lect.6 data model.pptx sewsf ewcxf sedwzc
PPTX
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
PPTX
Entity relationship model Database Management.pptx
PPTX
Link and association in Java
PPTX
Entity Relationship Diagram
PDF
database management systems-iT-243-L9.pdf
PDF
ERModel1.pdf
PPT
haythornthwaite
PPTX
Mapping cardinality (cardinality constraint) in ER MODEL
PPT
ermodelN in database management system.ppt
PDF
Dialogue based Meaning Negotiation
PPT
An investigation of the information literacy instruction practices, attitudes...
PPTX
Wk9 Slides Social Networks - Class.pptx
PPTX
Newsletter Presentation
Database week 6.pptx that inclekdjnd dnfj
E_R-Diagram (2).pptx
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
Unit 1 Data Modeling_Updated (2) (2).pptx
Transactional Research from the Inter/National Coalition for Electronic Portf...
DBMS_Lect.6 data model.pptx sewsf ewcxf sedwzc
3-db-er_3-db-er_3-db-er_3-db-er_3-db-er.pptx
Entity relationship model Database Management.pptx
Link and association in Java
Entity Relationship Diagram
database management systems-iT-243-L9.pdf
ERModel1.pdf
haythornthwaite
Mapping cardinality (cardinality constraint) in ER MODEL
ermodelN in database management system.ppt
Dialogue based Meaning Negotiation
An investigation of the information literacy instruction practices, attitudes...
Wk9 Slides Social Networks - Class.pptx
Newsletter Presentation
Ad

More from Esmatullah Adel (7)

PPTX
Introduction to sql_02
PPTX
Introduction to sql_01
PPTX
Mapping in database
PPTX
Enhanced entity relationship model
PPTX
Identifiers in database
PPTX
Requirements analysis
PPTX
Introduction to database
Introduction to sql_02
Introduction to sql_01
Mapping in database
Enhanced entity relationship model
Identifiers in database
Requirements analysis
Introduction to database
Ad

Recently uploaded (20)

PDF
Intravenous drug administration application for pediatric patients via augmen...
PPTX
Report in SIP_Distance_Learning_Technology_Impact.pptx
PPTX
From XAI to XEE through Influence and Provenance.Controlling model fairness o...
PDF
Introduction to c language from lecture slides
PDF
Child-friendly e-learning for artificial intelligence education in Indonesia:...
PDF
Ebook - The Future of AI A Comprehensive Guide.pdf
PDF
Be ready for tomorrow’s needs with a longer-lasting, higher-performing PC
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PPTX
Slides World Game (s) Great Redesign Eco Economic Epochs.pptx
PDF
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
PPTX
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
PDF
The AI Revolution in Customer Service - 2025
PDF
Technical Debt in the AI Coding Era - By Antonio Bianco
PDF
Decision Optimization - From Theory to Practice
PDF
NewMind AI Journal Monthly Chronicles - August 2025
PPTX
How to use fields_get method in Odoo 18
PDF
Domain-specific knowledge and context in large language models: challenges, c...
PDF
Internet of Things (IoT) – Definition, Types, and Uses
PDF
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
PDF
State of AI in Business 2025 - MIT NANDA
Intravenous drug administration application for pediatric patients via augmen...
Report in SIP_Distance_Learning_Technology_Impact.pptx
From XAI to XEE through Influence and Provenance.Controlling model fairness o...
Introduction to c language from lecture slides
Child-friendly e-learning for artificial intelligence education in Indonesia:...
Ebook - The Future of AI A Comprehensive Guide.pdf
Be ready for tomorrow’s needs with a longer-lasting, higher-performing PC
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
Slides World Game (s) Great Redesign Eco Economic Epochs.pptx
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
The AI Revolution in Customer Service - 2025
Technical Debt in the AI Coding Era - By Antonio Bianco
Decision Optimization - From Theory to Practice
NewMind AI Journal Monthly Chronicles - August 2025
How to use fields_get method in Odoo 18
Domain-specific knowledge and context in large language models: challenges, c...
Internet of Things (IoT) – Definition, Types, and Uses
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
State of AI in Business 2025 - MIT NANDA

Relationship in database

  • 2. Topics: • Relationship • Degree of a relation • Associative entity • Cardinality of relationships •‫ارتباط‬ •‫ارتباط‬ ‫درجه‬ •‫پذیر‬ ‫شرکت‬ ‫موجودیت‬ •‫ارتباط‬ ‫کاردینالیتی‬ 1:50 AM Gharjistan University Computer Science Faculty Farah Branch 2
  • 3. Relationship: • Showing association among two or more than two entity types is called Relationship. •‫اضا‬ ‫یا‬ ‫و‬ ‫دو‬ ‫بین‬ ‫رابطه‬ ‫دادن‬ ‫نشان‬‫فه‬ ‫بنام‬ ‫را‬ ‫موجودیت‬ ‫نوع‬ ‫دو‬ ‫از‬ ‫تر‬ ‫میکند‬ ‫یاد‬ ‫ارتباط‬. Nangarhar University Computer Sceince Faculty 3
  • 4. Continue… Nangarhar University Computer Sceince Faculty 4 Teacher SubjectTeaches
  • 5. Degree of a relation: • The number of entity types that participate in a relationship is called its degree. •‫یک‬ ‫در‬ ‫که‬ ‫موجودیت‬ ‫نوع‬ ‫تعداد‬ ‫درجه‬ ‫بنام‬ ‫میکند‬ ‫شرکت‬ ‫ارتباط‬ ‫میشود‬ ‫یاد‬ ‫ارتباط‬. Nangarhar University Computer Sceince Faculty 5
  • 6. Degree of a relation… • Three most common degree are: 1. Unary Relationship(Degree one). 2. Binary Relationship(Degree two). 3. Ternary Relationship(degree three). •‫ذیل‬ ‫قرار‬ ‫معمول‬ ‫بسیار‬ ‫درجه‬ ‫سه‬ ‫است‬: .1‫یگانه‬ ‫ارتباط‬(‫یک‬ ‫درجه‬) .2‫دوگانه‬ ‫ارتباط‬(‫دو‬ ‫درجه‬) .3‫گانه‬ ‫سه‬ ‫ارتباط‬(‫سه‬ ‫درجه‬) Nangarhar University Computer Sceince Faculty 6
  • 7. Unary relationship(degree one): • A relation between the instances of single entity type is called Unary(Degree one) Relationship . • An entity type linked with itself, also called recursive relationship. •‫ن‬ ‫یک‬ ‫های‬ ‫نمونه‬ ‫بین‬ ‫ارتباط‬ ‫یک‬‫وع‬ ‫یاد‬ ‫یگانه‬ ‫ارتباط‬ ‫بنام‬ ‫موجودیت‬ ‫میشود‬. •‫موجودیت‬ ‫نوع‬ ‫یک‬‫خودش‬ ‫با‬ ‫ایکه‬ ‫ارتباط‬ ‫بنام‬ ‫همچنان‬ ‫باشد‬ ‫وصل‬ ‫میشود‬ ‫یاد‬ ‫بازگشتی‬. Nangarhar University Computer Sceince Faculty 7 person Is_married_to EMPLOYEE Manages
  • 8. Binary relationship(degree two): • A relation between the instances of two entity types is called binary(degree two) relationship. •‫های‬ ‫نمونه‬ ‫بین‬ ‫ارتباط‬ ‫یک‬‫نوع‬ ‫دو‬ ‫ارتباط‬ ‫بنام‬ ‫موجودیت‬‫یاد‬ ‫دوگانه‬ ‫میشود‬. Nangarhar University Computer Sceince Faculty 8 Teacher SubjectTeaches
  • 9. Ternary relationship(degree three): • A Relationship between the instances of three entity types is called Ternary(Degree three) relationship. • Example: Many venders ships many items to many warehouses. •‫های‬ ‫نمونه‬ ‫بین‬ ‫ارتباط‬ ‫یک‬‫سه‬‫نو‬‫ع‬ ‫ارتباط‬ ‫بنام‬ ‫موجودیت‬‫ی‬ ‫گانه‬ ‫سه‬‫اد‬ ‫میشود‬. •‫مثال‬:‫اشیای‬ ‫زیاد‬ ‫گان‬ ‫فروشنده‬ ‫انتقال‬ ‫زیاد‬ ‫های‬ ‫گدام‬ ‫به‬ ‫را‬ ‫زیادی‬ ‫میدهد‬. Nangarhar University Computer Sceince Faculty 9
  • 10. Ternary relationship(degree three)… • The Institute might need to record which teachers taught which subjects in which courses. •‫داشت‬ ‫ضرورت‬ ‫ممکن‬ ‫انستیتیوت‬‫ه‬ ‫استا‬ ‫کدام‬ ‫که‬ ‫کند‬ ‫ثبت‬ ‫تا‬ ‫باشد‬‫کدام‬ ‫د‬ ‫درس‬ ‫صنف‬ ‫کدام‬ ‫در‬ ‫را‬ ‫مضمون‬ ‫میدهد‬. 1:50 AM Gharjistan University Computer Science Faculty Farah Branch 10
  • 11. Degree of relationships: Nangarhar University Computer Sceince Faculty 11 Entities of two different types related to each other. Entities of three different types related to each other. One entity related to another of the same entity type.
  • 12. Associative entity: • The presence of one or more attributes on a relationship suggests to the designer that the relationship should perhaps be represented as an entity type. • That entity type is called associative Entity. •‫یک‬ ‫از‬ ‫بیشتر‬ ‫یا‬ ‫و‬ ‫یک‬ ‫موجودیت‬ ‫ب‬ ‫ارتباط‬ ‫یک‬ ‫باالی‬ ‫خاصه‬ ‫صفت‬‫ه‬ ‫ارت‬ ‫که‬ ‫میکند‬ ‫پیشنهاد‬ ‫دیزاینر‬‫به‬ ‫باط‬ ‫داده‬ ‫نمایش‬ ‫موجودیت‬ ‫نوع‬ ‫شکل‬ ‫شود‬. •‫بنام‬ ‫موجودیت‬ ‫نوع‬ ‫این‬ ‫که‬ ‫میشود‬ ‫یاد‬ ‫پذیر‬ ‫شرکت‬ ‫موجودیت‬. Nangarhar University Computer Sceince Faculty 12 Nangarhar University Computer Sceince Faculty
  • 13. Associative entity example: Nangarhar University Computer Science Faculty 13 STUDENT COURSE Std_id S_name Course_id C_title Certificate Date_comp Certificate_No
  • 14. Cardinality of relationships: • One to One: • Each entity in the relationship will have exactly one related entity. • For example: •‫یک‬ ‫به‬ ‫یک‬: •‫یک‬ ً‫ا‬‫دقیق‬ ‫ارتباط‬ ‫در‬ ‫موجودیت‬ ‫هر‬ ‫داشت‬ ‫خواهد‬ ‫وابسته‬ ‫موجودیت‬. •‫مثال‬ ‫بطور‬: Nangarhar University Computer Sceince Faculty 14 Person Passporthas
  • 15. Cardinality of relationships… • One to Many: • An entity on one side of the relationship can have many related entities, but an entity on the other side will have a maximum of one related entity. • For example: •‫چند‬ ‫به‬ ‫یک‬: •‫ارتباط‬ ‫طرف‬ ‫یک‬ ‫در‬ ‫موجودیت‬ ‫یک‬ ‫وابس‬ ‫موجودیت‬ ‫چندین‬ ‫که‬ ‫میتواند‬‫ته‬ ‫طرف‬ ‫موجودیت‬ ‫اما‬ ‫باشد‬ ‫داشته‬ ‫را‬ ‫وابس‬ ‫موجودیت‬ ‫یک‬ ‫حداکثر‬ ‫دیگر‬‫ته‬ ‫داشت‬ ‫خواهد‬. •‫مثال‬ ‫بطور‬: Nangarhar University Computer Sceince Faculty 15 Instructor Coursesteaches
  • 16. Cardinality of relationships… • Many to Many: • Entities on both sides of the relationship can have many related entities on the other side. •‫چند‬ ‫به‬ ‫چند‬: •‫طرف‬ ‫دو‬ ‫هر‬ ‫در‬ ‫ها‬ ‫موجودیت‬ ‫موجودی‬ ‫چندین‬ ‫که‬ ‫میتواند‬ ‫ارتباط‬‫ت‬ ‫باش‬ ‫داشته‬ ‫دیگر‬ ‫طرف‬ ‫در‬ ‫وابسته‬‫د‬. 1:50 AM Gharjistan University Computer Science Faculty Farah Branch 16 Student CoursesRegister for
  • 17. Mandatory/Optional Relationships: • Participation by an entity in a relationship may be optional or mandatory. • For example: •‫یک‬ ‫در‬ ‫موجودیت‬ ‫یک‬ ‫شرکت‬ ‫اجباری‬ ‫یا‬ ‫و‬ ‫اختیاری‬ ‫ممکن‬ ‫رابطه‬ ‫باشد‬. •‫مثال‬ ‫بطور‬: Nangarhar University Computer Sceince Faculty 17 Employee CarDrives
  • 18. Continue… 1:50 AM Gharjistan University Computer Science Faculty Farah Branch 18
  • 19. Continue… 1:50 AM Gharjistan University Computer Science Faculty Farah Branch 19
  • 20. 1:50 AM Gharjistan University Computer Science Faculty Farah Branch 20