Download - Relationship in database
Topics:
• Relationship
• Degree of a relation
• Associative entity
• Cardinality of relationships
ارتباط•
درجه ارتباط•
موجودیت شرکت پذیر•
کاردینالیتی ارتباط•
1:50 AMGharjistan University Computer Science
Faculty Farah Branch2
Relationship:
• Showing association among two or more than two entity types is called Relationship.
فه نشان دادن رابطه بین دو و یا اضا•
تر از دو نوع موجودیت را بنام .ارتباط یاد میکند
Nangarhar University Computer Sceince Faculty
3
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_toEMPLOYEE
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 AMGharjistan University Computer Science
Faculty Farah Branch10
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
12Nangarhar 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 AMGharjistan University Computer Science
Faculty Farah Branch16
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