Relational Database Design and Modeling for Software Engineers
Ask Author
Back to course home

0% completed

Vote For New Content
Entities, Attributes, and Relationships
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

In the ER (Entity-Relationship) model, entities, attributes, and relationships are the core components used to define the structure of a database. Understanding these concepts is essential for designing a logical and efficient database.

In this lesson, we’ll explore the symbols used in ER models, define entities and entity sets, explain different types of attributes, and introduce relationships between entities. By the end of this lesson, you’ll have a foundational understanding of how these elements work together to form a well-structured data model.

Symbols Used in ER Models

ER diagrams utilize specific symbols to make the structure of data intuitive and easy to understand:

Image
  • Rectangles: Represent entities or groups of entities, known as entity sets, such as Student or Course.
  • Ellipses: Represent attributes, which are properties of entities like Name or Student ID.
  • Diamonds: Depict relationships between entities, like a Student enrolling in a Course.
  • Lines: Show connections between entities and attributes or between entities and relationships.
  • Double Ellipses: Used to indicate derived attributes, which are calculated from other attributes, such as Age derived from Date of Birth.
  • Double Rectangle: Double Rectangle represents a Weak Entity.

These symbols help visualize the data model and its structure, making it easier for designers and stakeholders to understand data requirements and organization.

Entities and Entity Sets

In the ER model, an entity is a real-world object or concept that is distinct and needs to be represented in the database. An entity is typically represented by a rectangle in ER diagrams.

Entity Example

For example, a Student in a school database is an entity that represents a real-world individual with data to be stored.

Image

An entity set is a collection of similar entities that share the same attributes. For instance, the Student entity set includes all individual students, each with attributes like Student ID, Name, and Date of Birth.

Image

Attributes

Attributes are properties or details about an entity. Each entity in an entity set has the same attributes, which are represented as ellipses in ER diagrams. Attributes provide specific details about each entity instance.

Key Attribute

A key attribute uniquely identifies each entity within an entity set, ensuring there are no duplicates.

  • Example: StudentID is a key attribute for the Student entity, uniquely identifying each student in the system.
Image

Composite Attribute

A composite attribute consists of multiple components, each of which has its own meaning. Composite attributes can be divided into smaller attributes.

  • Example: Address might be a composite attribute, which can be broken down into Country, State, City, and Street.
Image

Multivalued Attribute

A multivalued attribute can hold multiple values for a single entity instance. Unlike single-valued attributes, which store only one value per attribute, multivalued attributes allow for a list of values.

  • Example: For the Student entity, a multivalued attribute could be Phone Numbers if a student has multiple contact numbers.
Image

Derived Attribute

A derived attribute is calculated from other attributes and is not stored directly in the database.

  • Example: Age can be a derived attribute based on the Date of Birth.
Image

Relationship Type and Relationship Set

A relationship defines how two or more entities are associated. In ER diagrams, relationships are represented by diamonds connecting the related entities.

Relationship Type

A relationship type describes the association between two or more entity types without specifying the exact instances. For example, a Student may "enroll" in a Course. This general type of connection, "enrolls in," describes how students are related to courses.

Image

Relationship Set

A relationship set is a collection of similar relationships between instances of entities. For example, the set of all instances of students enrolled in courses forms a relationship set for the "enrolls in" relationship type.

Image

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible