12312021 Database Systems 12312021 Relationships Relationships 12312021 Relationships

  • Slides: 34
Download presentation
12/31/2021 Database Systems

12/31/2021 Database Systems

12/31/2021 Relationships

12/31/2021 Relationships

Relationships 12/31/2021 Relationships are the connections and interactions between the entities instances, e. g.

Relationships 12/31/2021 Relationships are the connections and interactions between the entities instances, e. g. , Program and Student ETs are linked How to identify relationships

12/31/2021 Naming Relationships Up to you If there is no proper name of the

12/31/2021 Naming Relationships Up to you If there is no proper name of the association in the system then participants’ names of abbreviations are used

Naming STUDENT and CLASS have ENROLL relationship However, it can also be named as

Naming STUDENT and CLASS have ENROLL relationship However, it can also be named as STD_CLS 12/31/2021

Symbol for Relationships 12/31/2021 DEPT EMP STD BOOK

Symbol for Relationships 12/31/2021 DEPT EMP STD BOOK

Relationships 12/31/2021 Relationship type can be identified like an entity type A relationship type

Relationships 12/31/2021 Relationship type can be identified like an entity type A relationship type is an abstraction of a relationship

Relationships 12/31/2021 Entities involved in a relationship are called its participants Types of the

Relationships 12/31/2021 Entities involved in a relationship are called its participants Types of the relationships can be established on the basis of participant ETs

12/31/2021 Relationships Types A Binary relationship is the one that links two entity types

12/31/2021 Relationships Types A Binary relationship is the one that links two entity types e. g. STUDENTCLASS

Binary Relationship Example COURSE STD BOOK PROJ EMP 12/31/2021 STD

Binary Relationship Example COURSE STD BOOK PROJ EMP 12/31/2021 STD

 12/31/2021 Binary Relationships May also have instances, that can be formally described in

12/31/2021 Binary Relationships May also have instances, that can be formally described in an ordered pair form {(S 1001, OS), (S 1020, DS), (S 1002, DS), (S 1058, NW)}

 The key The relationships can have their descriptive attributes Where to place 12/31/2021

The key The relationships can have their descriptive attributes Where to place 12/31/2021 Attributes of the Rships

Attributes of Rships 12/31/2021 GRADE STD COURSE

Attributes of Rships 12/31/2021 GRADE STD COURSE

Ternary Relationships 12/31/2021 One that involves three entity types STUDENT-CLASS-FACULTY

Ternary Relationships 12/31/2021 One that involves three entity types STUDENT-CLASS-FACULTY

12/31/2021 Ternary Relationship Examples

12/31/2021 Ternary Relationship Examples

STD COURSE 12/31/2021 FACULTY PROJ EMP SKILL

STD COURSE 12/31/2021 FACULTY PROJ EMP SKILL

 Instances in ordered triples Example {(S 1013, MCS 4, Adnan), (S 1023, MCS

Instances in ordered triples Example {(S 1013, MCS 4, Adnan), (S 1023, MCS 3, Fasih)} 12/31/2021 Ternary Relationships

12/31/2021 Unary Relationship An ET linked with itself, also called recursive relationship Example Roommate,

12/31/2021 Unary Relationship An ET linked with itself, also called recursive relationship Example Roommate, where STUDENT is linked with STUDENT

Unary Relationship Examples EMP ROOMMAT E CHAIRPERSON SPOUSE 12/31/2021 STD

Unary Relationship Examples EMP ROOMMAT E CHAIRPERSON SPOUSE 12/31/2021 STD

Number of instances of one entity type that can possibly be related to instances

Number of instances of one entity type that can possibly be related to instances of other entity type 12/31/2021 Cardinality of Rships

 One to one One to many Many to one Many to many 12/31/2021

One to one One to many Many to one Many to many 12/31/2021 Types of Cardinalities

Types of Cardinalities DEPT 12/31/2021 One to one Chair Person One to many/ many

Types of Cardinalities DEPT 12/31/2021 One to one Chair Person One to many/ many to one DEPT EMP PROJ Many to many

 Determines whether the link is compulsory or optional Important, since it effects the

Determines whether the link is compulsory or optional Important, since it effects the implementation 12/31/2021 Minimum Cardinality

Cardinality Example BOOK EMP PROJ STD COURSE STD HOBBY 12/31/2021 STD

Cardinality Example BOOK EMP PROJ STD COURSE STD HOBBY 12/31/2021 STD

Other Notations 12/31/2021 STD BOOK STD HOBBY PROJ EMP

Other Notations 12/31/2021 STD BOOK STD HOBBY PROJ EMP

Other Notations 12/31/2021 STD 1 M BOOK STD M 1 HOBBY PROJ M M

Other Notations 12/31/2021 STD 1 M BOOK STD M 1 HOBBY PROJ M M EMP

Other Notations 12/31/2021 DEPT 1 STD 1 PROJ 1 CHAIR BOOK EMP

Other Notations 12/31/2021 DEPT 1 STD 1 PROJ 1 CHAIR BOOK EMP

Roles in Relationships 12/31/2021 Determine the role ETs play in a relationship Most of

Roles in Relationships 12/31/2021 Determine the role ETs play in a relationship Most of the time is clear from the context, like in STD and COURSE relationship

 Two situation when they should be expressed explicitly A one to one relationship

Two situation when they should be expressed explicitly A one to one relationship Two ETs having more than one relationship 12/31/2021 Roles in Relationships

Roles Examples 12/31/2021 STD ENROLS ENROLMENT ENROLLED BY COURSE HEADS FACULTY HEADED BY

Roles Examples 12/31/2021 STD ENROLS ENROLMENT ENROLLED BY COURSE HEADS FACULTY HEADED BY

Roles Examples s Ta he ug ac ht By 12/31/2021 Te STD_TEACH FACULTY rvi

Roles Examples s Ta he ug ac ht By 12/31/2021 Te STD_TEACH FACULTY rvi pe STD_SUP Su sed rvi pe y b Su ses STD

A type of constraint Identifier dependency Referential Dependency 12/31/2021 Existence Dependency

A type of constraint Identifier dependency Referential Dependency 12/31/2021 Existence Dependency

bk. Id BOOK bk. Title 12/31/2021 Identifier dependency bk. Id BOOK COPY Copy. Id

bk. Id BOOK bk. Title 12/31/2021 Identifier dependency bk. Id BOOK COPY Copy. Id

Referential Dependency 12/31/2021 Emp. Id Employee Emp. Name Dep. Id Departmen t Dep. Nam

Referential Dependency 12/31/2021 Emp. Id Employee Emp. Name Dep. Id Departmen t Dep. Nam e