An overview of Entity Relationship Model (ERM) and its components, including entities, attributes, relationships, and their visual representation in Entity Relationship Diagrams (ERDs). Learn about different types of entities, attributes, and relationships, such as weak entities, simple and composite attributes, and cardinality. Understand the importance of keys and primary keys in identifying entities.
Download Understanding Entities, Attributes, and Relationships in Database Design and more Schemes and Mind Maps Database Management Systems (DBMS) in PDF only on Docsity!
Entity Relationship Model
Entity Relationship Model
(^) An Entity Relationship Diagram (ERD) is a visualrepresentation of different data using conventions that describe how these data are related to each other.
(^) For example, the elements writer, novel, and consumer may be described using ER diagrams this way: The elements inside rectangles are called entities while the items inside diamonds denote the relationships between entities.
Weak Entity
(^) A weak entity is an entity that depends on the existence ofanother entity.
(^) In more technical terms it can defined as an entity that cannot be identified by its own attributes.
(^) It uses a foreign key combined with its attributed to form the primary key.
(^) An entity like order item is a good example for this.
(^) The order item will be meaningless without an order so it depends on the existence of order.
Attributes
(^) Entities are represented by means of their properties ,
called attributes.
(^) All attributes have values.
(^) For example, a student entity may have name, class,
and age as attributes.
(^) There exists a domain or range of values that can be
assigned to attributes.
(^) For example, a student's name cannot be a numeric
value. It has to be alphabetic. A student's age cannot
be negative , etc.
Types of Attributes (contd.,)
(^) Derived attribute โ Derived attributes are the attributes that do not exist in the physical database, but their values are derived from other attributes present in the database.
(^) For example, average_salary in a department should not be saved directly in the database, instead it can be derived.
(^) For another example, age can be derived from data_of_birth.
(^) For example for a circle the area can be derived from the radius.
Types of Attributes (contd.,)
(^) Single-value attribute โ Single-value attributes contain singlevalue. For example โ Social_Security_Number.
(^) Multi-value attribute โ Multi-value attributes may contain morethan one values. For example, a person can have more than one phone number, email_address, etc.
(^) For example a teacher entity can have multiple subject values.
Entity-Set and Keys
(^) Key is an attribute or collection of attributes that uniquelyidentifies an entity among entity set.
(^) For example, the roll_number of a student makes him/her identifiable among students.
(^) Super Key โ A set of attributes (one or more) that collectively identifies an entity in an entity set.
(^) Candidate Key โ A minimal super key is called a candidate key. An entity set may have more than one candidate key.
(^) Primary Key โ A primary key is one of the candidate keys chosen by the database designer to uniquely identify the entity set.
Relationship
(^) The association among entities is called a relationship.
(^) For example, an employee works_at a department, a student enrolls in a course.
(^) Here, Works_at and Enrolls are called relationships.
(^) For example, the entity โ carpenter โ may be related to the entity โ table โ by the relationship โbuildsโ or โmakes โ. Relationships are represented by diamond shapes and are labeled using verbs.
Mapping Cardinalities
(^) Cardinality defines the number of entities in one entity set, which can be associated with the number of entities of other set via relationship set.
(^) One-to-one โ One entity from entity set A can be associated with at most one entity of entity set B and vice versa.
(^) One-to-many โ One entity from entity set A can be associated with more than one entities of entity set B however an entity from entity set B, can be associated with at most one entity.
Many-to-many โ One entity from A can be associated with more than one entity from B and vice versa.
ER Diagram Representation
(^) Let us now learn how the ER Model is represented by means of an ER diagram.
(^) Any object, for example, entities, attributes of an entity, relationship sets, and attributes of relationship sets, can be represented with the help of an ER diagram.
Attributes
(^) Attributes are the properties of entities. Attributes are
represented by means of ellipses.
(^) Every ellipse represents one attribute and is directly
connected to its entity (rectangle).
If the attributes are composite , they are further divided in atree like structure. Every node is then connected to its attribute. That is, composite attributes are represented by ellipses that are connected with an ellipse.