0% found this document useful (0 votes)
135 views

DB Assignment#04

The document discusses a database for a DVD rental company. It describes entities like branches, DVD stock, customers, and staff. It outlines attributes for each entity and relationships between them like branches having staff, customers renting DVDs, and branches stocking multiple copies of DVD titles.

Uploaded by

hiramujeeb15
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views

DB Assignment#04

The document discusses a database for a DVD rental company. It describes entities like branches, DVD stock, customers, and staff. It outlines attributes for each entity and relationships between them like branches having staff, customers renting DVDs, and branches stocking multiple copies of DVD titles.

Uploaded by

hiramujeeb15
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

ASSIGNMENT#04

SUBJECT: BIOINFORMATICS DATABASE

DATE: MAY 28, 2024


12.6 How does multiplicity represent both the cardinality and the participation constraints
on a relationship type?

SOLUTION:
Multiplicity in the context of the Entity-Relationship (ER) model specifies both the cardinality
and the participation constraints of a relationship type.
 Cardinality: This aspect of multiplicity refers to the number of instances of an entity that
can or must be associated with a single instance of another entity. It is often expressed as
"one-to-one", "one-to-many", or "many-to-many".
 Participation: This indicates whether all or only some entity instances participate in a
relationship. It is specified as either total (mandatory participation) or partial (optional
participation).
In an ER diagram, these constraints are often represented near the relationship lines connecting
entities. For example:
 1:1 (one-to-one): An instance of entity A is associated with at most one instance of entity
B and vice versa.
 1
(one-to-many): An instance of entity A can be associated with multiple instances of entity B, but
an instance of entity B is associated with at most one instance of entity A.
 M
(many-to-many): Multiple instances of entity A can be associated with multiple instances of
entity B.
12.8 Distinguish between the Entity—Relationship model and the Entity—Relationship
diagram.

SOLUTION:
 Entity-Relationship (ER) Model: This is a conceptual framework used to describe the
data structure and constraints in a database. It encompasses entities, attributes, and
relationships among entities. The ER model defines how data is interconnected and what
rules govern those connections.

 Entity-Relationship (ER) Diagram: This is a graphical representation of the ER model.


It uses symbols such as rectangles (for entities), ovals (for attributes), diamonds (for
relationships), and lines to connect them. The ER diagram visually displays the data
model, making it easier to understand and communicate the structure of the database.
12.9 Describe how fan and chasm traps can occur in an ER model and how they can be
resolved.
SOLUTION:
 Fan Trap: This occurs when a model represents a relationship between entity types
incorrectly due to ambiguity in the relationship path. It happens when a single entity is
related to multiple other entities through a common entity, leading to confusion in
interpreting the relationship.
 Example: If a "Department" entity is connected to both "Manager" and "Employee"
entities, it might be unclear whether a manager is an employee or if they are distinct
roles.
 Resolution: The fan trap can be resolved by restructuring the relationships to make the
roles and connections clear, possibly by introducing an additional entity or defining the
relationship more precisely.

 Chasm Trap: This occurs when a model represents a pathway between entities that
should not exist, leading to a scenario where some instances of an entity are not related to
instances of another entity, causing gaps in the relationship.
 Example: If a "Branch" entity is connected to "DVD" and "Customer" entities but there
is no direct connection between "DVD" and "Customer," there might be gaps in the
relationships, indicating that some rentals might not be properly recorded.
 Resolution: The chasm trap can be resolved by ensuring that all necessary relationships
are explicitly modeled, perhaps by adding intermediate relationships or entities to bridge
the gaps.
12.10 Create an ER model for each of the following descriptions:
(a) Each company operates four departments, and each department belongs to one
company.
 Entities: Company, Department
 Relationship: Operates (Company - Department)
 Multiplicity: Company (1) to Department (4), Department (N) to Company (1)

(b) Each department in part (a) employs one or more employees, and each employee works
for one department.
 Entities: Department, Employee
 Relationship: Employs (Department - Employee)
 Multiplicity: Department (1) to Employee (1..N), Employee (N) to Department (1)
(c) Each of the employees in part (b) may or may not have one or more dependents, and
each dependent belongs to one employee.
 Entities: Employee, Dependent
 Relationship: Has (Employee - Dependent)
 Multiplicity: Employee (0..N) to Dependent (1..N), Dependent (N) to Employee (1)

(d) Each employee in part (c) may or may not have an employment history.
 Entities: Employee, EmploymentHistory
 Relationship: Has (Employee - EmploymentHistory)
 Multiplicity: Employee (0..N) to EmploymentHistory (0..N), EmploymentHistory (N) to
Employee (1)

(e) Represent all the ER models described in (a), (b), (c), and (d) as a single ER model.

12.11 Assume you have been contracted by a university to develop a database system to
keep track of student registration and accommodation records. The university courses are
offered by faculties. Depending on the student’s IQ, there are no limitations to how many
courses a student can enroll in. The faculties are not responsible for student
accommodation. The university owns several hostels and each student is given a shared
room key after enrollment. Each room has furniture attached to it.
(a) Identify the main entity types for the project.
 University
 Course
 Faculty
 Student
 Hostel
 Room
(b) Identify the main relationship types and specify the multiplicity for each relationship.
State any assumptions that you make about the data.
1. University has Course: one-to-many (1: N)
The University can have many courses. So, their relationship is one-to-many.
2. Course offered by Faculty: many-to-one (N:1)
A course can be offered by one faculty. But a faculty can take many courses. So, the relationship
between course and faculty is many-to-one.
3. Student enrolled in Course: many-to-many (M: N)
A student can be enrolled in many courses based on their IQ and a course can have many
students enrolled in it. So, their relationship is many-to-many.
4. University owns a hostel: one-to-many (1: N)
The university owns several hostels. So, their relationship is one-to-many.
5. Hostel has rooms: one-to-many (1: N)
A hostel has many rooms. So, the relationship between the hostel and the room is one-to-many.
6. Room given to students: one-to-many (1: N)
One room is shared by many students. So, their relationship is one-to-many.

(c) Using your answers for (a) and (b), draw a single ER diagram to represent the data
requirements for the project.

 Here the strong entities are the university, course, faculty, hostel, student, and room.
 The university entity has the attributes university_id and university_name, where
university_id is the primary key attribute.
 The course entity has the attributes course_name and course_id. Here course_id is the
primary key attribute that uniquely identifies the course.
 The attributes of faculty entity are faculty_id and faculty_name, where faculty_id is the
primary key.
 The hostel entity has attributes hostel_id(primary key) and hostel_name.
 The attributes of room entity are room_no(primary key) and no_of_keys.
 The student entity have attributes student_id(primary key), student_name and student_IQ.
12.12 Read the following case study, which describes the data requirements for a DVD
rental company. The DVD rental company has several branches throughout the United
States. The data held on each branch is the branch address made up of street, city, state,
and zip code, and the telephone number. Each branch is given a branch number, which is
unique throughout the company. Each branch is allocated staff, which includes a Manager.
The Manager is responsible for the day-to-day running of a given branch. The data held on
a member of staff is his or her name, position, and salary. Each member of staff is given a
staff number, which is unique throughout the company. Each branch has a stock of DVDs.
The data held on a DVD is the catalog number, DVD number, title, category, daily rental,
cost, status, and the names of the main actors and the director. The catalog number
uniquely identifies each DVD. However, in most cases, there are several copies of each
DVD at a branch, and the individual copies are identified using the DVD number. A DVD
is given a category such as Action, Adult, Children, Drama, Horror, or Sci-Fi. The status
indicates whether a specific copy of a DVD is available for rent. Before borrowing a DVD
from the company, a customer must first register as a member of a local branch. The data
held on a member is the first and last name, address, and the date that the member
registered at a branch. Each member is given a member number, which is unique
throughout all branches of the company. Once registered, a member is free to rent DVDs,
up to a maximum of ten at any one time. The data held on each DVD rented is the rental
number, the full name and number of the member, the DVD number, title, and daily
rental, and the dates the DVD is rented out and returned. The DVD number is unique
throughout the company.
(a) Identify the main entity types of the DVD rental company.
 Rental Company
 Brach
 DVD Stock
 Rented
 Customer
 Staff Member

(b) Identify the main relationship types between the entity types described in part (a) and
represent each relationship as an ER diagram.
The various relationships between the different entities are the ones in the diamond-shaped
structures shown in the 'f' part of the same question.
(c) Determine the multiplicity constraints for each relationship described in part (b).
Represent the multiplicity for each relationship in the ER diagrams created in part (b).
The multiplicity constraints are:
 A single rental company has many branches, therefore, one-to-many relations
 Many branches have many DVD stocks, there are many too many relations
 Many DVDs are rented to many customers, therefore many to many relations.
 Many customers register at many different branches, therefore many to many relations.
 Many branches have many staff members, therefore many to many relations are shown.

(d) Identify attributes and associate them with entity or relationship types. Represent each
attribute in the ER diagrams created in (c).

Entity Attributes

Rental
Name, Owner Info
Company

Branch Branch Number, Address, Name, Phone No.

Catalog Number, Cost, DVD No., Actors,


DVD Stock
Title, Rental Amount, Status

Customer Member Number, Name, Address, Phone No.

Staff Member Staff Number, Name, Position, Salary

(e) Determine candidate and primary key attributes for each (strong) entity type.
The primary key attributes are the ones that are underlined in the ER DIAGRAM shown in part
'f' of the same question. They are:
 Branch Number
 Catalog Number
 Rental Number
 Member Number
 Staff Number
(f) Using your answers to parts (a) to (e), attempt to represent the data requirements of the
DVD rental company as a single ER diagram. State any assumptions necessary to support
your design.

You might also like