DBMS
DBMS
→entity
An entity is a piece of data that is stored in the database. An entity can be a person, place,
thing, or even an event. There are two types of entities in DBMS: strong and weak.
ER diagram is created based on three principal components:
1.Entities-strong entity & weak entity.
Strong entity:For example, in a Database for a company's employees, the "Employee" Entity
can be considered a strong Entity Type.It will be the main part of that data.It is represented by a
single rectangle.
Weak Entity: For example,in a database for a car, colour of the car is not an important
thing.That type of not important but it is a part of that data is called weak entity.The weak entity
is represented by a double rectangle.
2.Attributes
An entity can have one or more attributes, which are properties or characteristics that describe
the entity. For example, a customer can have attributes such as name, email, phone no and
address.
● Simple Attributes-it is an independent attribute.it doesn't have subdivisions or any other
classifications.eg:roll no,reg no.
● Composite Attributes-it has division or classifications.eg:name-fname mname lname.
● Single Valued Attributes-accept only one value.eg:roll no,age
● Multi-Valued Attributes-an attribute that can have more than one value associated with
the key of the entity.eg:a customer can have more than one phone no.
● Derived Attributes-are those attributes whose values can be derived from the values of
other attributes.eg:From DOB, we can derive the Age attribute, which changes every
year, and can easily calculate the age.
● Complex Attributes -(Rarely used attributes)They are formed by the combination of
multi-valued and composite attributes.eg:address is a composite attribute and phone no
is a multivalued attribute then,the complex attribute will be address_phone no.
● Key Attributes -Key attributes are special types of attributes that act as the primary key
for an entity and they can uniquely identify an entity from an entity set.eg:Roll_no of a
student will always be unique to identify the student.
● Stored Attributes-Values of stored attributes remain constant and fixed for an entity
instance and also, and they help in deriving the derived attributes.eg:the Age attribute
can be derived from the Date of Birth attribute, and also, the Date of birth attribute has a
fixed and constant value throughout the life of an entity. Hence, the Date of Birth attribute
is a stored attribute.
3.Relationships
It depicts the relationship between two entities.The diamond shape showcases a relationship in
the ER diagram.
● One-to-One Relationships-When a single element of an entity is associated with a single
element of another entity, it is called a one-to-one relationship.
Eg: a student has only one identification card and an identification card is given to one
person.
● One-to-Many Relationships-When a single element of an entity is associated with more
than one element of another entity.eg:a customer can place many orders, but an order