Top Banner
Relationship رتباط ا کنندهیه ته: عادل عصمت
20

Relationship in database

Jan 24, 2018

Download

Technology

Esmatullah Adel
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Relationship in database

Relationship

ارتباط

عصمت هللا عادل: تهیه کننده

Page 2: Relationship in database

Topics:

• Relationship

• Degree of a relation

• Associative entity

• Cardinality of relationships

ارتباط•

درجه ارتباط•

موجودیت شرکت پذیر•

کاردینالیتی ارتباط•

1:50 AMGharjistan University Computer Science

Faculty Farah Branch2

Page 3: Relationship in database

Relationship:

• Showing association among two or more than two entity types is called Relationship.

فه نشان دادن رابطه بین دو و یا اضا•

تر از دو نوع موجودیت را بنام .ارتباط یاد میکند

Nangarhar University Computer Sceince Faculty

3

Page 4: Relationship in database

Continue…

Nangarhar University Computer Sceince Faculty

4

Teacher SubjectTeaches

Page 5: Relationship in database

Degree of a relation:

• The number of entity types that participate in a relationship is called its degree.

تعداد نوع موجودیت که در یک •

ارتباط شرکت میکند بنام درجه .ارتباط یاد میشود

Nangarhar University Computer Sceince Faculty

5

Page 6: Relationship in database

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

Page 7: Relationship in database

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

Page 8: Relationship in database

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

Page 9: Relationship in database

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

Page 10: Relationship in database

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

Page 11: Relationship in database

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.

Page 12: Relationship in database

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

Page 13: Relationship in database

Associative entity example:

Nangarhar University Computer Science Faculty

13

STUDENT COURSE

Std_id S_name Course_id C_title

Certificate

Date_comp

Certificate_No

Page 14: Relationship in database

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

Page 15: Relationship in database

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

Page 16: Relationship in database

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

Page 17: Relationship in database

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

Page 18: Relationship in database

Continue…

1:50 AMGharjistan University Computer Science

Faculty Farah Branch18

Page 19: Relationship in database

Continue…

1:50 AMGharjistan University Computer Science

Faculty Farah Branch19

Page 20: Relationship in database

1:50 AMGharjistan University Computer Science

Faculty Farah Branch20