Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
42 views21 pages

Dms Ch2 Solution-1

The document outlines the design of an Enhanced Entity-Relationship (EER) schema for a BANK database, detailing entities such as banks, branches, accounts, and loans, along with their relationships. It explains the concepts of strong and weak entities, types of keys, attributes, and participation constraints in database management. Additionally, it covers specialization and generalization in entity modeling, comparing ER and EER models.

Uploaded by

pythonwork98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views21 pages

Dms Ch2 Solution-1

The document outlines the design of an Enhanced Entity-Relationship (EER) schema for a BANK database, detailing entities such as banks, branches, accounts, and loans, along with their relationships. It explains the concepts of strong and weak entities, types of keys, attributes, and participation constraints in database management. Additionally, it covers specialization and generalization in entity modeling, comparing ER and EER models.

Uploaded by

pythonwork98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

DATABASE MANAGEMENT SYSYTEM

CH2 – ENTITY RELATIONASHIP DATA MODEL

1. Design an EER schema for a BANK database.


Each bank can have multiple branches and branch can have
multiple accounts and loans. Bank keeps the track of different
types of Accounts (Saving_account, checking_account),
Loans(Car_loans, Home_loans, ….), each accounts
transaction(Deposite, withdrawal, cheques, …) and each loan’s
payemets; both of these include the amount, data and time.To
design an Enhanced Entity-Relationship (EER) schema for the BANK
database, we need to model the following entities and relationships
based on the given requirements:

B_name

Bank

B_code

B_add

Loan_type
Payment_time
Done
through

has

Transaction

T_id
T_type

1
2. Draw EER diagram for Hospital Management System.
ER Diagram Template 3
https://edrawmax.wondershare.com/database-tips/er-diagram-
templates-for-hospital-management.html

2
3. Describe weak and strong entity. Provide an example of weak entity
and strong entity.
Strong Entity
 It is an entity that has its own existence and is independent.
 A strong entity is not dependent on any other entity in the schema. A
strong entity will always have a primary key. Strong entities are
represented by a single rectangle. The relationship of two strong
entities is represented by a single diamond. Various strong entities,
when combined together, create a strong entity set.

Weak Entity
 An entity type should have a key attribute which uniquely identifies
each entity in the entity set, but there exists some entity type for
which key attribute can‟t be defined. These are called Weak Entity
type.
 It is an entity that does not have its own existence and relies on a
strong entity for its existence.
 A weak entity is dependent on a strong entity to ensure its existence.
Unlike a strong entity, a weak entity does not have any primary key. It
instead has a partial discriminator key. A weak entity is represented
by a double rectangle. The relation between one strong and one weak
entity is represented by a double diamond. This relationship is also
known as an identifying relationship.

3
Example of the relationship between the Strong entity type and weak entity
type with the help of ER Diagram:

4. Define with an example different type of entities in ER diagram.


Strong Entity
 It is an entity that has its own existence and is independent.
 A strong entity is not dependent on any other entity in the schema. A
strong entity will always have a primary key. Strong entities are
represented by a single rectangle.
 The relationship of two strong entities is represented by a single diamond.
Various strong entities, when combined together, create a strong entity
set.

Weak Entity
 An entity type should have a key attribute which uniquely identifies each
entity in the entity set, but there exists some entity type for which key
attribute can‟t be defined. These are called Weak Entity type.
 It is an entity that does not have its own existence and relies on a strong
entity for its existence.
 A weak entity is dependent on a strong entity to ensure its existence.
Unlike a strong entity, a weak entity does not have any primary key. It
instead has a partial discriminator key. A weak entity is represented by a
double rectangle.

4
 The relation between one strong and one weak entity is represented by a
double diamond. This relationship is also known as an identifying
relationship.

Example of the relationship between the Strong entity type and weak entity
type with the help of ER Diagram:

5
5. List and Explain the Types of keys.

A. Primary key:
A primary key is a unique key, meaning it can uniquely identify each
record (tuple) in a table. It must have unique values and cannot contain
any duplicate values.
A primary key cannot be NULL, as it needs to provide a valid, unique
identifier for every record.

B. Candidate key:
A candidate key is a minimal super key, meaning it can uniquely identify
a record but contains no extra attributes.A candidate key is an attribute
or set of attributes that can uniquely identify a tuple.
Except for the primary key, the remaining attributes are considered a
candidate key. The candidate keys are as strong as the primary key.
Every table must have at least a single candidate key.

6
C. Super key:
The set of one or more attributes (columns) that can uniquely identify a
tuple (record) is known as Super Key. A super key is a superset of a
candidate key.
A super key can contain extra attributes that aren‟t necessary for
uniqueness. Every primary key is a super key, but not every super key is
a primary key.

D. Foreign key:
Foreign keys are the column of the table used to point to the primary key
of another table. The table that contains the foreign key is called the
referencing table, and the table that is referenced is called the referenced
table.
A foreign key in one table points to the primary key in another table,
establishing a relationship between them.

E. Alternate key
An alternate key is any candidate key in a table that is not chosen as the
primary key. In other words, all the keys that are not selected as the
primary key are considered alternate keys.
An alternate key is also referred to as a secondary key because it can
uniquely identify records in a table, just like the primary key. An
alternate key can consist of one or more columns (fields) that can
uniquely identify a record, but it is not the primary key.

7
F. Composite Key
A composite key is a primary key that consists of two or more columns,
used to uniquely identify a record when a single column is insufficient.
It involves combining multiple columns to create a unique identifier for a
record. It is typically used when no single column can provide
uniqueness.

G. Artificial key:
The key created using arbitrarily assigned data are known as artificial
keys. These keys are created when a primary key is large and complex
and has no relationship with many other relations. The data values of
the artificial keys are usually numbered in a serial order.

6. List and Explain the Types of attributes.


Attribute: In a Database Management System (DBMS), an attribute is
a property or characteristic of an entity that is used to describe an
entity.
Types of attribute:
A. Simple Attribute.
B. Composite Attribute.
C. Single Valued Attribute.
D. Multivalued Attribute.
E. Stored Attribute.
F. Derived Attribute.
G. Complex Attribute.
H. Key Attribute.
I. Null Attribute
J. Descriptive Attribute

8
A. Simple Attribute
An attribute that cannot be further subdivided into components is a
simple attribute.
Example: The roll number of a student, the ID number of an employee,
gender, and many more.

B. Composite Attribute
An attribute that can be split into components is a composite attribute.
Example: The address can be further split into house number, street
number, city, state, country, and pin code, the name can also be split
into first name middle name, and last name.

C. Single-Valued Attribute
The attribute which takes up only a single value for each entity instance
is a single-valued attribute.
Example: The age of a student, Aadhar card number.

9
D. Multi-Valued Attribute
The attribute which takes up more than a single value for
each entity instance is a multi-valued attribute. And it is represented by
double oval shape.
Example: Phone number of a student: Landline and mobile.

E. Stored Attribute
The stored attribute are those attribute which doesn‟t require any type of
further update since they are stored in the database.
Example: DOB(Date of birth) is the stored attribute.

F. Derived Attribute
An attribute that can be derived from other attributes is derived
attributes. And it is represented by dotted oval shape.
Example: Total and average marks of a student, age of an employee that
is derived from date of birth.

10
G. Complex Attribute
Those attributes, which can be formed by the nesting of composite and
multi-valued attributes, are called “Complex Attributes“. These attributes
are rarely used in DBMS(DataBase Management System). That‟s why
they are not so popular.
Example: Address because address contain composite value like street,
city, state, PIN code and also multivalued because one people has more
that one house address.

H. Key attribute
Key attributes are those attributes that can uniquely identify the entity
in the entity set.
Example: Roll-No is the key attribute because it can uniquely identify
the student.

I. Null Attribute
This attribute can take NULL value when entity does not have value for
it.
Example –The „Net Banking Active Bin‟ attribute gives weather
particular customer having net banking facility activated or not
activated.
For bank which does not offer facility of net banking in customer table
„Net Banking Active Bin‟ attribute is always null till Net banking facility
is not activated as this attribute indicates Bank offers net banking
facility or does not offers.

11
J. Descriptive Attribute
Descriptive attribute give information about the relationship set example
given below. Here Start Date is the descriptive attribute of Manages
relationship.

7. Explain the terms total participation and partial participation with


example.
Participation Constraints in database management refer to rules that
determine the minimum and maximum participation of entities or
relationships in a given relationship set. While partial participation permits
discretionary involvement, total participation requires every entity in one set
to take part in a relationship in another set. By maintaining consistency and
enforcing business standards, these restrictions guarantee data integrity.

Total Participation
 Entire participation, sometimes known as required participation,
denotes the requirement that each individual in a group participate in
an activity pertaining to another group. It's similar to saying that in
order to belong to one group, you must somehow be associated with
another.
 In a university database, for instance, total participation between
courses and students indicates that each student is required to be
registered in a minimum of one course. It follows that no student can be
excluded from a course. It serves as a means of guaranteeing that every
member of one group is connected to something within another,
ensuring that nothing is overlooked or left disconnected.
 In below digram, The Participation of an entity set E in a relationship set
R is said to be total if every entity in E participates in at least one
relationship in R.
 The participation of entity set A in the relationship set is total because
every entity and The participation of entity set B in the relationship set
is also total because every entity of B also participates in the
relationship set.

12
Partial Participation
 In database design, partial participation—also known as optional
participation—allows certain aspects of a relationship to be optional. It
implies that the way the database is configured does not require that
every entity be linked to every other thing. Consider a database at a
university, for instance.
 Partial participation can mean that some students are enrolled in
classes but not all students are registered in them. Because it recognizes
that not everything in real life is always connected to everything else,
this flexibility is crucial. While some objects are connected to one
another, others may stand alone. It permits scenarios in which certain
database entities may not be connected to any other entity.
 In below diagram, The participation of an entity set E in relationship set
R is said to be partial if only some entities in E participate in
relationships in R.
 The participation of entity set A in the relationship set is partial because
only some entities of A participate in the relationship set. while the
participation of entity set B in the relationship set is total because every
entity of B participates in the relationship set.

13
Example:
Suppose an entity set Student related to an entity set Course through
Enrolled relationship set.
The participation of entity set course in enrolled relationship set
is partial because a course may or may not have students enrolled in. It is
possible that only some of the course entities are related to the student
entity set through the enrolled relationship set.
The participation of entity set student in enrolled relationship set
is total because every student is expect to relate at least one course
through the enrolled relationship set.

8. Construct an ER diagram for a car insurance company that has a set


of customers each of whom owns one or more cars. Each car has
associated with it zero to any number of recorded accidents.

14
9. Define Specialization and Generalization and write short note on it.
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.
 Specialization is the process of defining subtypes or subclasses of an
entity based on some distinguishing characteristics or properties. It
involves dividing a higher-level entity (called a superclass) into lower-
level entities (called subclasses) that share some specific features.
 It is used when you want to create more detailed entities (subclasses)
that inherit some attributes from a common superclass but also have
their own unique attributes.
 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).
 Specialization is also called as ” Top-Down approch”.

Advantages of Specialization
 Enhances Specificity: By forming specialized subgroups, it is possible
to depict things in more depth.
 Encourages Inheritance: Relationships and characteristics from
higher-level entities are passed down to lower-level entities.
 Enhances Data Integrity: Makes certain that every entity have distinct
qualities relevant to its area of expertise.

Disadvantages of Specialization
 Expands Schema Size: Adding additional entities may lead to an
increase in the schema‟s complexity and size.
 Can Cause Redundancy: There might be certain characteristics that are
duplicated across specialized entities

15
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.
 Generalization is the reverse of specialization. It is the process of
abstracting common features from multiple entities to form a higher-level
entity (a superclass). In this case, specific entities (called subclasses) are
generalized into a more general entity that represents the shared features
of all the subclasses.
 It is used when you want to combine multiple specific entities into a more
generic entity, capturing their common attributes and relationships.
 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).
 Generalization is also called as „ Bottom-up approach”.

Advantages of Generalization
 Cuts Down on Redundancy: Cuts down on data duplication by
combining related entities into a single entity.
 Simplifies Schema: Combines many things into a single, clearer
schema.
 Enhances Data Organization: By cohesively presenting related entities,
it makes better organization possible.

Disadvantages of Generalization
 Loss of Specificity: The generic entity may take center stage over the
distinctive qualities of lower-level entities.
 Complexity of Querying: As data becomes more abstracted, queries
may get more complicated.

16
10. Compare ER & EER models

Feature ER Model EER Model

Basic Concept Entity and Extended with complex


relationships relationships and
hierarchies
Specialization/ Not present Present (models
Generalization hierarchies)
Aggregation Not present Present(model relationship
between relationships)
Complexity Simpler, used for More complex, handles
basic data modeling advanced relationships
and structures
Entity Entities represented Same as ER, but supports
Representation as a rectangles subtypes and supertypes.
Relationship Relationship Same as ER, but supports
Representation represented as advanced relationships
diamonds (aggregation,
specialization)
Subtype/Supertype Not present Present (models
inheritance Hierarchies)
Attributes Simple attributes on Same as ER, but can be
entities and extended for complex
relationships models
Use Cases Simple database Complex and detailed
designs database designs involving
inheritance and abstraction
Diagram Notation Entities(rectangles), Same as ER, triangles for
Relationships specialization/generalizatio
(diamonds), Attributes n, and rectangles for
(ovals) aggregation

17
11. Draw E-R diagram for university database consisting of four
entities: student, department, class, faculty, Student has a unique
id, the student can enroll for multiple classes and has at most one
major. Faculty must belong to the department and faculty can teach
multiple classes. Each class is taught by only one faculty. Every
student will get a grade for the class he/she has enrolled in.

12. Draw ER diagram for Hotel Management System.


https://www.geeksforgeeks.org/how-to-design-er-diagrams-for-hotel-
and-hospitality-management/

18
13. Draw ER diagram for Student Management System.

Or
https://www.edrawmax.com/templates/er-diagram-for--student-
managment-system-1054392/

19
14. Draw ER diagram for Railway Reservation Management System.
https://edrawmax.wondershare.com/templates/er-diagram-for-railway-
reservation-system.html

20
15. Draw an ER diagram for the education database that contains
the information about an in house company education training
scheme.
The relevant relations are:
 Course (course-no, title)
 Offering (course-no, off-no, off-date, location)
 Teacher (course-no, off-no, emp-no)
 Enrolment (course-no, off-no, stud-no, grade)
 Employee (emp-no, emp-name, job)
 Student (stud-no, stud-name, ph-no)

https://creately.com/diagram/example/hp50p96t1/er-diagram-for-
a-educational-institute

grade
job
ph-no

has ENROLLMENT
h

off-no

teacher
offering

21

You might also like