0% found this document useful (0 votes)
38 views11 pages

Assignment 1amna

The document outlines various scenarios requiring the creation of Entity-Relationship Diagrams (ERDs) for different organizational contexts, including companies, laboratories, colleges, hospitals, banks, consulting firms, art museums, and publishers. Each scenario includes specific attributes and relationships, along with questions prompting analysis of naming conventions, associative entities, and the implications of changes in requirements. The document emphasizes the importance of clear data modeling and the ability to adapt ERDs based on evolving business needs.

Uploaded by

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

Assignment 1amna

The document outlines various scenarios requiring the creation of Entity-Relationship Diagrams (ERDs) for different organizational contexts, including companies, laboratories, colleges, hospitals, banks, consulting firms, art museums, and publishers. Each scenario includes specific attributes and relationships, along with questions prompting analysis of naming conventions, associative entities, and the implications of changes in requirements. The document emphasizes the importance of clear data modeling and the ability to adapt ERDs based on evolving business needs.

Uploaded by

sarayousuf437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Database Systems

ASSIGNMENT 1
AMNA YOUSAF
JUW24755

Draw an ERD for each of the following situations. (If you believe that you need to make
additional assumptions, clearly state them for each situation.) Draw the same situation using the
tool you have been told to use in the course.

1.A company has a number of employees. The attributes of EMPLOYEE include Employee ID
(identifier), Name, Address, and Birthdate. The company also has several projects. Attributes of
PROJECT include Project ID (identifier), Project Name, and Start Date. Each employee may be
assigned to one or more projects, or may not be assigned to a project. A project must have at
least one employee assigned and may have any number of employees assigned. An employee’s
billing rate may vary by project, and the company wishes to record the applicable billing rate
(Billing Rate) for each employee when assigned to a particular project. Do the attribute names in
this description follow the guidelines for naming attributes? If not, suggest better names. Do you
have any associative entities on your ERD? If so, what are the identifiers for those associative
entities? Does your ERD allow a project to be created before it has any employees assigned to it?
Explain. How would you change your ERD if the Billing Rate could change in the middle of a
project?
Answers:
Do the attribute names follow the guidelines for naming attributes? If not, suggest better names?
 The attribute names are clear
Do you have any associative entities on your ERD? If so, what are the identifiers for those associative
entities?
 Yes, the ASSIGNMENT table is an associative entity. Its identifier is a composite key:
(Employee_ID, Project_ID).

Does your ERD allow a project to be created before it has any employees assigned to it? Explain.
 No, the ERD does not allow a project to exist without at least one employee assigned.

How would you change your ERD if the Billing Rate could change in the middle of a project?

 No changes to the ERD are needed. The Billing_Rate in the ASSIGNMENT table can be
updated at any time to reflect changes.
2.A laboratory has several chemists who work on one or more projects. Chemists also may use
certain kinds of equipment on each project. Attributes of CHEMIST include Employee ID
(identifier), Name, and Phone No. Attributes of PROJECT include Project ID (identifier) and
Start Date. Attributes of EQUIPMENT include Serial No and Cost. The organization wishes to
record Assign Date—that is, the date when a given equipment item was assigned to a particular
chemist working on a specified project. A chemist must be assigned to at least one project and
one equipment item. A given equipment item need not be assigned, and a given project need not
be assigned either a chemist or an equipment item. Provide good definitions for all of the
relationships in this situation
Relationship Definitions:
1. CHEMIST to PROJECT:
A chemist must be assigned to at least one project.
A project may or may not have chemists assigned.
2. CHEMIST to EQUIPMENT:
A chemist must be assigned to at least one equipment item.
An equipment item may or may not be assigned to a chemist.
3. PROJECT to EQUIPMENT:
A project may or may not have equipment assigned.
An equipment item may or may not be assigned to a project.
4. ASSIGNMENT:
This associative entity records the assignment of a chemist to a project and an equipment
item, along with the Assign_Date.

3.A college course may have one or more scheduled sections, or may not have a scheduled
section. Attributes of COURSE include Course ID, Course Name, and Units. Attributes of
SECTION include Section Number and Semester ID. Semester ID is composed of two parts:
Semester and Year. Section Number is an integer (such as 1 or 2) that distinguishes one section
from another for the same course but does not uniquely identify a section. How did you model
SECTION? Why did you choose this way versus alternative ways to model SECTION?
Why This Modeling Approach Was Chosen
Composite Primary Key:
 The SECTION table uses a composite primary key
(Course_ID, Semester_ID, Section_Number) because:
 Section_Number alone is not unique globally (e.g., multiple courses can have a section
numbered "1").
 A section is uniquely identified only within the context of a specific course and semester.

4.A hospital has a large number of registered physicians. Attributes of PHYSICIAN include
Physician ID (the identifier) and Specialty. Patients are admitted to the hospital by physicians.
Attributes of PATIENT include Patient ID (the identifier) and Patient Name. Any patient who is
admitted must have exactly one admitting physician. A physician may optionally admit any
number of patients. Once admitted, a given patient must be treated by at least one physician. A
particular physician may treat any number of patients, or may not treat any patients. Whenever a
patient is treated by a physician, the hospital wishes to record the details of the treatment
(Treatment Detail). Components of Treatment Detail include Date, Time, and Results. Did you
draw more than one relationship between physician and patient? Why or why not? Did you
include hospital as an entity type? Why or why not? Does your ERD allow for the same patient
to be admitted by different physicians over time? How would you include on the ERD the need
to represent the date on which a patient is admitted for each time they are admitted?

Answers:
1. Two relationships exist
between PHYSICIAN and PATIENT: Admission and Treatment .These are separate
relationships because they represent different interactions (admitting vs. treating)
2. The HOSPITAL entity was not included because it is not relevant to the problem.
3. The ERD allows for multiple admissions of the same patient by different physicians
over time.
4. The Admission_Date as an attribute is included in the ADMISSION table to record
the date of each admission.
5.The loan office in a bank receives from various parties requests to investigate the credit status
of a customer. Each credit request is identified by a Request ID and is described by a Request
Date and Requesting Party Name. The loan office also received results of credit checks. A credit
check is identified by a Credit Check ID and is described by the Credit Check Date and the
Credit Rating. The loan office matches credit requests with credit check results. A credit request
may be recorded before its result arrives; a particular credit result may be used in support of
several credit requests. Draw an ERD for this situation. Now, assume that credit results may not
be reused for multiple credit requests. Redraw the ERD for this new situation using two entity
types, and then redraw it again using one entity type. Which of these two versions do you prefer,
and why?

Option 1:
Option 2:

I prefer the two-entity version because


 If the requirements change in the future (e.g., credit results can be reused),
the two-entity version can easily adopt this by reintroducing
the MATCH associative entity.
 The two-entity version clearly distinguishes between credit requests and
credit checks, making the schema easier to understand and maintain.
 If additional attributes or relationships are introduced for credit checks
(e.g., different types of credit ratings), the two-entity version can handle
this more gracefully.

6.Companies, identified by Company ID and described by Company Name and Industry Type,
hire consultants, identified by Consultant ID and described by Consultant Name, Consultant
Specialty, which is multivalued. Assume that a consultant can work for only one company at a
time, and we need to track only current consulting engagements. Draw an ERD for this situation.
Now, consider a new attribute, Hourly Rate, which is the rate a consultant charges a company for
each hour of his or her services. Redraw the ERD to include this new attribute. Now, consider
that each time a consultant works for a company, a contract is written describing the terms for
this consulting engagement. Contract is identified by a composite identifier of Company ID,
Consultant ID, and Contract Date. Assuming that a consultant can still work for only one
company at a time, redraw the ERD for this new situation. Did you move any attributes to
different entity types in this latest situation? As a final situation, now consider that although a
consultant can work for only one company at a time, we now need to keep the complete history
of all consulting engagements for each consultant and company. Draw an ERD for this final
situation. Explain why these different changes to the situation led to different data models, if
they did.

Adding Hourly Rate


Adding Contracts

Complete History
Why the Data Models Changed
1. Adding Hourly Rate:
The Hourly_Rate was added to the ENGAGEMENT entity because it is specific to the
consulting relationship.
2. Adding Contracts:
The introduction of contracts required a new entity (CONTRACT) to track the terms and
details of each engagement. The Hourly_Rate was moved to the CONTRACT entity because
it is now specific to each contract.
3. Tracking Complete History:
The CONTRACT entity was expanded to include all historical engagements, not just the
current one. This required no structural changes but altered the semantics of
the CONTRACT entity to include historical data.

7.An art museum owns a large volume of works of art. Each work of art is described by an item
code (identifier), title, type, and size; size is further composed of height, width, and weight. A
work of art is developed by an artist, but the artist for some works is unknown. An artist is
described by an artist ID (identifier), name, date of birth, and date of death (which is null for still
living artists). Only data about artists for works currently owned by the museum are kept in the
database. At any point in time, a work of art is either on display at the museum, held in storage,
away from the museum as part of a traveling show, or on loan to another gallery. If on display at
the museum, a work of art is also described by its location within the museum. A traveling show
is described by a show ID (identifier), the city in which the show is currently appearing, and the
start and end dates of the show. Many of the museum works may be part of a given show, and
only active shows with at least one museum work of art need be represented in the database.
Finally, another gallery is described by a gallery ID (identifier), name, and
city. The museum wants to retain a complete history of loaning a work of art to other galleries,
and each time a work is loaned, the museum wants to know the date the work was loaned and the
date it was returned. As you develop the ERD for this problem, follow good data naming
guidelines.

8.Each publisher has a unique name; a mailing address and telephone number are also kept on
each publisher. A publisher publishes one or more books; a book is published by exactly one
publisher. A book is identified by its ISBN, and other attributes are title, price, and number of
pages. Each book is written by one or more authors; an author writes one or more books,
potentially for different publishers. Each author is uniquely described by an author ID, and we
know each author’s name and address. Each author is paid a certain royalty rate on each book he
or she authors, which potentially varies for each book and for each author. An author receives a
separate royalty check for each book he or she writes. Each check is identified by its check
number, and we also keep track of the date and amount of each check. As you develop the ERD
for this problem, follow good data naming guidelines.

You might also like