Chapter 2
Chapter 2
Chapter 2
Data Models
Entity-Relationship Model
Data Models
Entity-Relationship Model (Contd..)
Line label
Entity Relationship Entity Attribute
Attribute
relationship
Entities
Data Models
Entity-Relationship Model (Contd..)
Dependent Entity
Data Models
Entity-Relationship Model (Contd..)
Relationships
• A relationship is an association among entities.
• depicted as a diamond with the name of the relationship type.
Data Models
Entity-Relationship Model (Contd..)
Relationships
• A relationship can associate an entity with itself.
• Multiple relationships can also exist between the same entities.
Data Models
Entity-Relationship Model (Contd..)
Relationships
• There are three types of relationships:
• One-to-One
• One-to-Many (or Many-to-One)
• Many-to-Many
One-to-One Relationship
Entity-Relationship Model (Contd..)
Relationships
Many-to-One Relationship
Many-to-Many Relationship
Entity-Relationship Model (Contd..)
Attributes
• An attribute is a property of an entity.
• Attributes are depicted as ellipses, labeled with the name of
the property. The key properties are underlined.
• A relationship can also have attributes.
Entity-Relationship Model (Contd..)
Attributes
Entity-Relationship Model (Contd..)
Subtypes and Supertypes
• A subtype is a subset of another entity.
Entity-Relationship Model (Contd..)
Subtypes and Supertypes
• A subentity/subtype always depends on the supertype.
• attributes of a supertype apply to all of its subtypes.
• Subtypes are connected to the supertype by an unnamed
relationship.
• Supertype is connected to the relationship with a line
containing a crossbar.
Activity
Record-based Models
1. Hierarchical model
• data is represented in the form of a tree
2. Network model
• Similar to a hierarchical model in the way that data and the
relationships are represented in the form of records and
links.
3. Relational model
• database is structured in fixed-format records of several
types.
Record-based Models
1. Hierarchical model
• data is represented in the form of a tree
2. Network model
• Similar to a hierarchical model in the way that data and the
relationships are represented in the form of records and
links.
3. Relational model
• database is structured in fixed-format records of several
types.
Record-based Models
1. Hierarchical model
• data is represented in the form of a tree
2. Network model
• Similar to a hierarchical model in the way that data and the
relationships are represented in the form of records and
links.
3. Relational model
• database is structured in fixed-format records of several
types.
Record-based Models
1. Hierarchical model
Record-based Models
2. Network model
Record-based Models
3. Relational Model
Relational Model
Relational Data Structure
Data Models
Relational Data Structure (Contd..)
Data Models
Relational Algebra
Data Models