ER or Entity-Relationship data modeling is a popular method for
designing and organizing data in a database system. It provides a graphical
representation of the entities, attributes, and relationships that exist within
a data model. In this article, we will explore the key terms and concepts
related to the ER data model.
Entities:
Entities are objects, things or concepts that we want to store
data about. Examples of entities in a database might include customers, orders,
products, or employees. In ER data modeling, entities are represented by
rectangles with the entity name written inside.
Simple attributes:
Simple attributes are single, indivisible
values that cannot be further subdivided. For example, a customer entity might
have simple attributes like name, address, and phone number.
Composite attributes:
Composite attributes are
made up of more than one simple attribute. For example, an address attribute
might be composed of street, city, state, and zip code attributes.
Derived attributes:
Derived attributes are attributes that can be calculated or derived from other attributes. They are not stored in the database but can be calculated when needed. For example, the age of a person can be derived from their date of birth.
Key Attributes: Key
attributes are those attribute that shows unique attribute for the entity.
Multivalued Attributes:
These attributes value can be calculated from other attributes. E.g. strudent’s Age can be calculate from DOB attribute.
Primary Key:
A primary key is a unique identifier for each entity in the
database. It is used to distinguish one entity from another and is used to
create relationships between entities. For example, a customer ID might be used
as the primary key for a customer entity. In an ER diagram, the primary key is
indicated with an underline.
Foreign Key:
A foreign key is a field in one table that refers to the primary
key of another table. It is used to establish a relationship between two
tables. For example, an order table might have a foreign key that refers to a
customer ID in a customer table. In an ER diagram, a foreign key is represented
as a dotted line connecting the two tables.
Relationships:
Relationships define how entities are related to each other. There
are three types of relationships in ER data modeling: one-to-one, one-to-many,
and many-to-many.
One-to-One Relationship:
A one-to-one relationship exists when one entity is related to
only one other entity. For example, a person might have only one passport. In
an ER diagram, a one-to-one relationship is represented by a straight line
connecting two entities.
One-to-Many Relationship:
A one-to-many relationship exists when one entity is related to
many other entities. For example, a customer might have many orders. In an ER
diagram, a one-to-many relationship is represented by a straight line with an
arrow pointing to the "many" side.
Many-to-Many Relationship:
A many-to-many relationship exists when many entities are related
to many other entities. For example, a student might take many courses and a
course might have many students. In an ER diagram, a many-to-many relationship
is represented by a line with two arrows pointing to the "many"
sides.
Cardinality:
Cardinality refers to the number of instances of an entity that
can be related to another entity. In ER data modeling, cardinality is indicated
using symbols at the ends of the relationship lines.
The symbols used for cardinality are:
"1" to represent a one-to-one relationship
"1-M" to represent a one-to-many relationship
"M-N" to represent a many-to-many relationship
In conclusion, the Entity-Relationship data model is a powerful
tool for organizing and designing data in a database system. Understanding the
key terms and concepts related to ER data modeling is essential for building
effective and efficient database systems. By using these concepts, developers
and database administrators can create database systems that are easier to
understand, maintain and operate.