Module 2 DBMS Jan2024
Module 2 DBMS Jan2024
Francis Institute of
Technology and is solely for educational purposes. Distribution and
modifications of the content is prohibited.
Subject Incharge
Dr. Kavita Sonawane
Professor & HOD
email: [email protected]
Module 2
Module 2
Roll
Name Date of Birth
No.
1] strong entity
2] Weak entity
Strong entity
• One strong entity set “Building” and one weak entity set “Apartment” are
related to each other.
• Strong entity set “Building” has building number as its primary key.
• Door number is the discriminator of the weak entity set “Apartment”.
• This is because door number alone can not identify an apartment uniquely as
there may be several other buildings having the same door number.
• Double line between Apartment and relationship set signifies total participation.
• It suggests that each apartment must be present in at least one building.
• Single line between Building and relationship set signifies partial participation.
• It suggests that there might exist some buildings which has no apartment.
The material in this presentation belongs to St. Francis Institute of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
A. Key Attribute
The attribute which uniquely identifies each
entity in the entity set is called key attribute.
For example, Roll_No or student ID will be unique
for each student.
In ER diagram, key attribute is represented by an
oval with underlying lines.
b. Composite Attribute
An attribute that composed of many other
attributes is known as a composite attribute. The
composite attribute is represented by an ellipse,
and those ellipses are connected with an ellipse.
For example, Address attribute of student Entity
type consists of Street, City, State, and Country.
c. Multivalued Attribute
An attribute can have more than one value. These
attributes are known as a multivalued attribute.
The double oval is used to represent multivalued
attribute.
For example, a student can have more than one
phone number.
d. Derived Attribute
An attribute that can be derived from other attribute
is known as a derived attribute. It can be
represented by a dashed ellipse.
For example, A person's age changes over time
and can be derived from another attribute like Date
of birth.
3. Relationship
A relationship is used to describe the
relation between entities.
Diamond or rhombus is used to represent
the relationship.
Here,
• One student can enroll in at most one course.
• One course can be enrolled by at most one student.
• Example
1] Here, one department has one head of the
department (HOD).
Participation constraints deal with the participation of entities from an entity set in a
relationship set
2. Partial Participation-
Types of key:
1. Super Key
Super key is a set of an attribute which can uniquely identify a
tuple. Super key is a superset of a candidate key.
Super Key can contain multiple attributes that might not be
able to independently identify tuples in a table, but when
grouped with certain keys, they can identify tuples uniquely.
• NOTE-
• All the attributes in a super key are definitely sufficient to identify each
tuple uniquely in the given relation but all of them may not be
necessary.
2. Candidate key
A candidate key is an attribute or set of an attribute which can uniquely
identify a tuple.
The remaining attributes except for primary key are considered as a
candidate key. The candidate keys are as strong as the primary key.
For example: In the EMPLOYEE table, id is best suited for the primary key.
Rest of the attributes like SSN, Passport_Number, and License_Number, etc.
are considered as a candidate key.
1 hyyu ui
2 uiui iiiu
3 juyiyi nhhyj
The material in this presentation belongs to St. Francis Institute of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
3. Primary key
It is the first key which is used to identify one and only one instance of an
entity uniquely.
A table cannot have more than one primary key.
In the EMPLOYEE table, ID can be primary key since it is unique for each
employee. In the EMPLOYEE table, we can even select License_Number and
Passport_Number as primary key since they are also unique.
4. Foreign key
• Foreign keys are the column of the table which is
used to point to the primary key of another table.
• A foreign key is the one that is used to link two
tables together via the primary key. It means the
columns of one table points to the primary key
attribute of the other table.
In the Student table, the field Stud_Id is a primary key because it is uniquely
identifying all other fields of the Student table.
On the other hand, Stud_Id is a foreign key attribute for the Department table
because it is acting as a primary key attribute for the Student table. It means that both
the Student and Department table are linked with one another because of the Stud_Id
attribute.
• structure of the relationship between the two
tables.
The material in this presentation belongs to St. Francis Institute of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
Specialization
1) {SalariedEmployee,HourlyEmployee}
- Classified based on paying method.
Specialization is a top down approach in which one entity is broken down into
low level entity.
The material in this presentation belongs to St. Francis Institute of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
Generalization
• Generalization is the reverse process of
specialization.
• In generalization, you generalize a set of entity
types into one superclass entity type. Therefore, the
generalized entity types are considered subclasses.
• If you find a set of classes with many common
attributes, they can be considered subclasses and
generalized to a common entity (superclass).
Specialization –
In specialization, an entity is divided into sub-entities based on
their characteristics. It is a top-down approach where higher
level entity is specialized into two or more lower level entities.
For Example, EMPLOYEE entity in an Employee management
system can be specialized into DEVELOPER, TESTER etc.
In this case, common attributes like E_NAME, E_SAL etc.
become part of higher entity (EMPLOYEE) and specialized
attributes like TES_TYPE become part of specialized entity
(TESTER).
Aggregation
• An ER diagram is not capable of representing
relationship between an entity and a relationship
which may be required in some scenarios.
• In those cases, a relationship with its corresponding
entities is aggregated into a higher level entity.
• Aggregation is an abstraction through which we can
represent relationships as higher level entity sets.
In real world, we know that a manager not only manages the employee
working under them but he has to manage the project as well. In such
scenario if entity “Manager” makes a “manages” relationship with either
“Employee” or “Project” entity alone then it will not make any sense
because he has to manage both. In these cases the relationship of two
entities acts as one entity. In our example, the relationship “Works-On”
between “Employee” & “Project” acts as one entity that has a relationship
“Manages” with the entity “Manager”.
Module 2 Done!!