Dbmsmodels Updated1111111111
Dbmsmodels Updated1111111111
3
Commonly used data models
• Hierarchical Model
• Network Model
• Relational Model
• E-R Model
E-R Model
Basic Building Blocks
• Entity
– Anything about which data will be collected/stored
• Attribute
– Characteristic of an entity
• Relationship
– Describes an association among entities
• One-to-one (1:1) relationship
• One-to-many (1:M) relationship
• Many-to-many (M:N or M:M) relationship
• Constraint
– A restriction placed on the data
Entity Sets
• A database can be modeled as:
– a collection of entities,
– relationship among entities.
Example:
customer = (customer-id, customer-name,
customer-street, customer-city)
loan = (loan-number, amount)
Composite Attributes
Relationship Sets
A relationship is an association among several entities
Example:
Hayes depositor A-102
customer entityrelationship setaccount entity
Degree of a Relationship Set
• Refers to number of entity sets that participate in a
relationship set.
• Relationship sets that involve two entity sets are binary
(or degree two). Generally, most relationship sets in a
database system are binary.
• Relationship sets may involve more than two entity
sets.
E.g. Suppose employees of a bank may have jobs
(responsibilities) at multiple branches, with different jobs at
different branches. Then there is a ternary relationship set
between entity sets employee, job and branch
Ternary Relationship
Mapping Cardinalities
• 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
24
Hierarchical DB model
Advantages
• Conceptual simplicity
• Data independence