DBMS P
DBMS P
Types:
There are two types of entity:
• Strong Entity:
It does not depend on other Entity in the Schema. It has a primary
key, that helps in identifying it uniquely, and it is represented by a
rectangle. These are called Strong Entity Types.
• Weak Entity:
An Entity type has a key attribute that uniquely identifies each
entity in the entity set. But some entity type exists for which key
attributes can’t be defined. These are called Weak Entity types.
Attributes
Attributes are the properties that define the entity type. For
example, Roll No, Name, DOB, Age, Address, and Mobile No are
the attributes that define entity type Student. In ER diagram, the
attribute is represented by an oval.
Types:
There are 4 types of entity:
• Key Attribute:
The attribute which uniquely identifies each entity in the entity set
is called the key attribute.
• Composite Attribute:
An attribute composed of many other attributes is called a
composite attribute.
• Multivalued Attribute:
An attribute consisting of more than one value for a given entity.
• Derived Attribute:
An attribute that can be derived from other attributes of the entity
type is known as a derived attribute.
A relationship in DBMS defines how two or more entities are
associated with each other. Relationships help structure and
organize data in a meaningful way, ensuring database integrity.
Types:
There are 4 types of entity:
• One-to-One:
When each entity in each entity set can take part only once in the
relationship.
• One-to-Many:
When each entity can be related to more than one entity.
• Many-to-One:
When entities in one entity set can take part only once in the relationship
set and entities in other entity sets can take part more than once in the
relationship set.
• Many-to-Many:
When entities in all entity sets can take part more than once in the
relationship.
Weak entity with total participation
A "weak entity with total participation" means that every instance of a
weak entity must be associated with a corresponding instance of its
identifying (strong) entity; in simpler terms, every weak entity must be
linked to a related strong entity, and none can exist independently without
this connection.
Example:
Consider a database storing information about employees and their
dependents. "Dependent" would be the weak entity, and "Employee"
would be the strong entity. Since every dependent must be associated
with an employee, this relationship would have total participation.
Discriminator
The discriminator of a weak entity set is a set of attributes that differentiates it.
In the below example, the collection of sec_id, semester and year put together is
called ‘discriminator’.
The discriminator is also called a ‘partial key’.
The discriminator of a weak entity set is underlined with dashes.
The relationship between a strong entity set and a weak entity set is combined with a double
diamond.
The primary key of the weak entity set is formed by the primary key of the identifying entity set,
plus the weak entity set’s discriminator.
Hence, the primary key of a weak entity set is :
course_id, sec_id, semester, year
The figure illustrates the use of double lines to indicate total participation.
And the arrow from sec_course to course indicates that each section is related to a single
course.
Generalization
Generalization is the process of extracting common properties
from a set of entities and creating a generalized entity from it. It
is a bottom-up approach in which two or more entities can be
generalized to a higher-level entity if they have some attributes
in common. For Example, STUDENT and FACULTY can be
generalized to a higher-level entity called PERSON as shown in
Figure 1. In this case, common attributes like P_NAME, and
P_ADD become part of a higher entity (PERSON), and
specialized attributes like S_FEE become part of a specialized
entity (STUDENT).
Specialization
In specialization, an entity is divided into sub-entities based on its
characteristics. It is a top-down approach where the higher-level
entity is specialized into two or more lower-level entities. For Example,
an EMPLOYEE entity in an Employee management system can be
specialized into DEVELOPER, TESTER, etc. as shown in Figure 2. In
this case, common attributes like E_NAME, E_SAL, etc. become part
of a higher entity (EMPLOYEE), and specialized attributes like
TES_TYPE become part of a specialized entity (TESTER).