Docsity

Relationship Sets in Database Systems: Concepts, Degree, Cardinality Constraints, and Keys, Slides of Database Management Systems (DBMS)

Toggle sidebar
bg1
Modeling
•A database can be modeled as:
–a collection of entities,
–relationship among entities.
•An entity is an object that exists and is distinguishable
from other objects.
–Example: specific person, company, event, plant
•Entities have attributes
–Example: people have names and addresses
•An entity set is a set of entities of the same type that
share the same properties.
–Example: set of all persons, companies, trees, holidays
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a

Partial preview of the text

Download Relationship Sets in Database Systems: Concepts, Degree, Cardinality Constraints, and Keys and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Modeling

  • A database can be modeled as:
    • a collection of entities,
    • relationship among entities.
  • An entity is an object that exists and is distinguishable from other objects. - Example: specific person, company, event, plant
  • Entities have attributes
    • Example: people have names and addresses
  • An entity set is a set of entities of the same type that share the same properties. - Example: set of all persons, companies, trees, holidays

Entity Setscustomer_id customer_ customer_ customer_ customer and loan_ loan amount

name street city number

Relationship Set borrower

Relationship Sets (Cont.)

  • An attribute can also be property of a relationship set.
  • For instance, the depositor relationship set between entity sets customer and account may have the attribute access-date

Composite Attributes

Mapping Cardinality Constraints

  • Express the number of entities to which another entity can be associated via a relationship set.
  • Most useful in describing binary relationship sets.
  • For a binary relationship set the mapping cardinality must be one of the following types: - One to one - One to many - Many to one - Many to many

Mapping Cardinalities

Many to one Many to many Note: Some elements in A and B may not be mapped to any elements in the other set

Keys

  • A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity.
  • A candidate key of an entity set is a minimal super key - Customer_id is candidate key of customer - account_number is candidate key of account
  • Although several candidate keys may exist, one of the candidate keys is selected to be the primary key.

E-R Diagrams

 Rectangles represent entity sets.  Diamonds represent relationship sets.  Lines link attributes to entity sets and entity sets to relationship sets.  Ellipses represent attributes  Double ellipses represent multivalued attributes.  Dashed ellipses denote derived attributes.  Underline indicates primary key attributes (will study later)

E-R Diagram With Composite,

Multivalued, and Derived Attributes

Roles

  • Entity sets of a relationship need not be distinct
  • The labels “manager” and “worker” are called roles ; they specify how employee entities interact via the works_for relationship set.
  • Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles.
  • Role labels are optional, and are used to clarify semantics of the relationship

Cardinality Constraints

  • We express cardinality constraints by drawing either a directed line (→), signifying “one,” or an undirected line (—), signifying “many,” between the relationship set and the entity set.
  • One-to-one relationship:
    • A customer is associated with at most one loan via the relationship borrower
    • A loan is associated with at most one customer via borrower

Many-To-One Relationships

  • In a many-to-one relationship a loan is associated with several (including 0) customers via borrower , a customer is associated with at most one loan via borrower

Many-To-Many Relationship

  • A customer is associated with several (possibly 0) loans via borrower
  • A loan is associated with several (possibly 0) customers via borrower