relationships
TRANSCRIPT
![Page 1: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/1.jpg)
Muhammad Umair
Relationships
Oracle Database 11g Developer Track
![Page 2: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/2.jpg)
What is a Relation ?› A mathematical definition:
– if A, B are sets, then a relation R is a subset of A x B› A={1,2,3}, B={a,b,c,d},
R = {(1,a), (1,c), (3,b)}
- makes is a subset of Product x Company:1
2
3
a
b
c
d
A=
B=makes Company
Product
![Page 3: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/3.jpg)
Relation› Relationship
– Relationship is defined as a meaningful association among instance of one or more entities.
– E.g. Students reads for degree, Students passes course, Teacher serve department.
› Degree of Relationship– Number of entities involved in a relationship
› Types of Relationship– Unary Relationship
A relationship among instance of single entities
![Page 4: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/4.jpg)
Relation– Binary Relationship
A relationship among instance of two entities
– Ternary RelationshipA relationship among instance of three entities.
› Maximum Cardinality– If and b are two associated entities then maximum cardinality of
A will be the maximum number of instance of A that can be associated with a single instance of B.
– Maximum cardinality can be either “one” or “many”
![Page 5: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/5.jpg)
Relation› Minimum Cardinality
– If and b are two associated entities then minimum cardinality of A will be the minimum number of instance of A that can be associated with a single instance of B.
– minimum cardinality can be either “zero” or “one”› Types of Relationship on the basis of Maximum Cardinality
– One-to-One Relationship› A relationship having cardinality “one” on both sides
– One-to-Many Relationship› A relationship having cardinality “one” on one side and “many” on other
side– Many-to-Many Relationship
› A relationship having cardinality “many” on both sides
![Page 6: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/6.jpg)
Multiplicity of E/R Relations› one-one:
› many-one
› many-many
123
abcd
123
abcd
123
abcd
![Page 7: Relationships](https://reader036.vdocuments.site/reader036/viewer/2022083104/58808eea1a28ab35718b7375/html5/thumbnails/7.jpg)
address name ssn
Person
buys
makes
employs
CompanyProduct
name category
stockprice
name
price