×
>
<

DBMS

DBMS ER Models | CrackEase

Entity Relationship Models

What is an Entity Relationship Diagram (ERD)?

An ER diagram shows the logical relationships between data items in a database and provides a user-oriented view of how data is organized. Main components are:

  • Entities
  • Attributes
  • Relationships

Unit components of ER Diagram

Entity representation in ER diagram

Entity

An entity is a real-world object or concept represented in an ERD. For example, in a college database, Student is an entity.

Examples: Teachers, Course, Building, Classroom.

Representation: A rectangle.

Entity set: A collection of similar entities (e.g., all students).

Attributes

Attribute representation in ER diagram

Attributes are properties of an entity. For a Student entity, typical attributes are:

  • ID
  • Email
  • Age
  • Address
  • Phone number

Representation: Ovals (connected to the entity).

Common attribute types include:

  • Key attribute
  • Composite attribute
  • Multivalued attribute
  • Derived attribute

Key Attribute

Key attribute example

A key attribute uniquely identifies an entity instance. Example: Student roll number or Course code (e.g., IT101).

Representation: An oval with an underline.

Composite Attribute

Composite attribute example

A composite attribute consists of multiple sub-attributes. Example: Address may include House number, Street, City, State, Country, Pin code.

Representation: An oval connected to sub-ovals for components.

Multivalued Attribute

Multivalued attribute example

A multivalued attribute can have multiple values for one entity. Example: a student may have multiple phone numbers.

Representation: A double-lined oval.

Derived Attribute

Derived attribute example

A derived attribute is computed from other attributes. Example: Age can be derived from Date of Birth.

Representation: A dashed oval.

Relationship

Relationship representation

A relationship represents an association between entities. Example: Students enroll in Courses.

Representation: A diamond connecting related entities.

Types of relationships:

  • Unary (recursive)
  • Binary
  • n-ary

A relationship set groups similar relationships between entity sets.

Unary Relationship

A unary (recursive) relationship involves a single entity type related to itself. Example: A Person entity may have a married_to relationship to another Person.

Binary Relationship

A binary relationship connects two different entity types. Example: Students enrolled in a Course.

n-ary Relationship

An n-ary relationship involves more than two entity types. These are useful for complex associations but often transformed into simpler tables for implementation.

Example (conceptual): entities like Person, Animal, Plant participating in an eats relationship.

Cardinality

Cardinality defines how many instances of one entity can be associated with instances of another entity in a relationship.

One-to-One (1:1)

Each instance of entity A relates to at most one instance of entity B, and vice-versa. Example: one man married to one woman (in the simplified model).

Many-to-One (N:1)

Many instances of entity A may relate to a single instance of entity B. Example: Many students may enroll in one particular course (if constrained).

Many-to-Many (M:N)

Many instances of entity A may relate to many instances of entity B. Example: Students can enroll in many courses and each course can have many students.

Participation Constraint

Total Participation

All entities in an entity set must participate in the relationship (represented by a double line). Example: University requires every student to enroll in at least one course (policy example).

Partial Participation

Only some entities participate in the relationship (represented by a single line). Example: Some students may choose not to enroll in optional activities.

Weak Entity and Weak Relationship

A weak entity depends on another (strong) entity for its identity and usually lacks a fully unique key on its own. Example: Installment depends on Loan. Weak entities typically have total participation in the identifying relationship.

Representation: Double rectangle (entity) and double diamond (identifying relationship).

Footer Content | CrackEase