0% found this document useful (0 votes)
63 views19 pages

DBS Bank

dbs

Uploaded by

huong996275
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)
63 views19 pages

DBS Bank

dbs

Uploaded by

huong996275
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/ 19

CH2-P15-d: Final 2018, Mid 2015 (ERD)

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?

Solution
CH2-P15-i: Final 2017, Mid 2013 (ERD)
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.

Solution
CH2-P17: Final 2019 (ERD)
Emerging Electric wishes to create a database with the following entities and
attributes: • Customer, with attributes Customer ID, Name, Address (Street, City,
State, Zip Code), and Telephone • Location, with attributes Location ID, Address
(Street, City, State, Zip Code), and Type (values of Business or Residential) • Rate,
with attributes Rate Class and RatePerKWH After interviews with the owners, you
have come up with the following business rules: • Customers can have one or
more locations. • Each location can have one or more rates, depending on the
time of day. Draw an ERD for this situation and place minimum and maximum
cardinalities on the diagram. Also, draw a data model for this situation using the
tool you have been told to use in your course. State any assumptions that you
have made.

Solution
CH2-P23: Final 2016 (ERD)
Projects, Inc., is an engineering firm with approximately 500 employees. A
database is required to keep track of all employees, their skills, projects assigned,
and departments worked in. Every employee has a unique number assigned by
the firm and is required to store his or her name and date of birth. If an employee
is currently married to another employee of Projects, Inc., the date of marriage
and who is married to whom must be stored; however, no record of marriage is
required if an employee’s spouse is not also an employee. Each employee is given
a job title (e.g., engineer, secretary, and so on). An employee does only one type
of job at any given time, and we only need to retain information for an
employee’s current job. There are 11 different departments, each with a unique
name. An employee can report to only 1 department. Each department has a
phone number. To procure various kinds of equipment, each department deals
with many vendors. A vendor typically supplies equipment to many departments.
We are required to store the name and address of each vendor and the date of
the last meeting between a department and a vendor. Many employees can work
on a project. An employee can work on many projects (e.g., Southwest Refinery,
California Petrochemicals, and so on) but can only be assigned to at most one
project in a given city. For each city, we are interested in its state and population.
An employee can have many skills (preparing material requisitions, checking
drawings, and so on), but she or he may use only a given set of skills on a
particular project. (For example, an employee MURPHY may prepare requisitions
for the Southwest Refinery project and prepare requisitions as well as check
drawings for California Petrochemicals.) Employees use each skill that they
possess in at least one project. Each skill is assigned a number, and we must store
a short description of each skill. Projects are distinguished by project numbers,
and we must store the estimated cost of each project.
Solution
Null: Mid 2015 (ERD)
Chefs work at restaurants. A chef is uniquely identified by a social security
number (ssn) and is also described by a name and a cuisine in which she
specializes. A restaurant is uniquely identified by a combination of name and city.
Each chef works in at least one restaurant, and each restaurant must have at least
one chef working at it. Some chefs own restaurants, and if a chef owns a
restaurant – she is its only owner.

Solution
Null: Mid 2014 (ERD)
The company you work for wants to digitize their time cards. You have been
asked to design the database for submitting and approving time cards. Draw the
database ER diagram with the following information: A timecard should have
hours worked and date submitted

▪ Each timecard is associated with exactly one employee


▪ Each timecard should have a unique id
▪ Each timecard has a status: it is either approved, not approved, or pending
▪ Each employee has a unique id
▪ Each employee has a name and address.
▪ Each employee submits a time card every pay period. i.e. In 1 year, they will
submit multiple time cards
▪ Each employee either has direct deposit or physical check as their method of
payment
▪ Each employee is associated with exactly one manager
▪ Each manager has a unique id and a name
▪ Each manager is in charge of multiple employees
▪ Each manager approves time cards for multiple employees
Solution
CH3-P7: Mid 2015 (EERD)
A rental car agency classifies the vehicles it rents into four categories: compact,
midsize, full-size, and sport utility. The agency wants to record the following data
for all vehicles: Vehicle ID, Make, Model, Year, and Color. There are no unique
attributes for any of the four classes of vehicle. The entity type vehicle has a
relationship (named Rents) with a customer entity type. None of the four vehicle
classes has a unique relationship with an entity type. Would you consider creating
a supertype/subtype relationship for this problem? Why or why not?

Solution
CH3-P12: Mid 2015, Mid 2013 (EERD)
A nonprofit organization depends on a number of different types of persons for
its successful operation. The organization is interested in the following attributes
for all of these persons: SSN, Name, Address, City/State/Zip, and Telephone.
Three types of persons are of greatest interest: employees, volunteers, and
donors. Employees have only a Date Hired attribute, and volunteers have only a
Skill attribute. Donors have only a relationship (named Donates) with an Item
entity type. A donor must have donated one or more items, and an item may
have no donors, or one or more donors. There are persons other than employees,
volunteers, and donors who are of interest to the organization, so that a person
need not belong to any of these three groups. On the other hand, at a given time
a person may belong to two or more of these groups (e.g., employee and donor).

Solution
CH3-P14: Final 2018, Final 2016, Mid 2014 (EERD)
A person may be employed by one or more organizations, and each organization
may be the employer of one or more persons. An organization can be an internal
organizational unit or an external organization. For persons and organizations, we
want to know their ID, name, address, and phone number. For persons, we want
to know their birth date, and for organizations, we want to know their budget
number. For each employment, we want to know the employment date,
termination date, and bonus. Employment of a person by an organization may
result in the person holding many positions over time. For each position, we want
to know its title, and each time someone holds that position, we need to know
the start date and termination date and salary. An organization is responsible for
each position. It is possible for a person to be employed by one organization and
hold a position for which another organization is responsible.

Solution
CH3-P20: Final 2019, Final 2017 (EERD)
TomKat Entertainment is a chain of theaters owned by former husband and wife
actors/entertainers who, for some reason, can’t get a job performing anymore.
The owners want a database to track what is playing or has played on each screen
in each theater of their chain at different times of the day. A theater (identified by
a Theater ID and described by a theater name and location) contains one or more
screens for viewing various movies. Within each theater each screen is identified
by its number and is described by the seating capacity for viewing the screen.
Movies are scheduled for showing in time slots each day. Each screen can have
different time slots on different days (i.e., not all screens in the same theater have
movies starting at the same time, and even on different days the same movie may
play at different times on the same screen). For each time slot, the owners also
want to know the end time of the time slot (assume all slots end on the same day
the slot begins), attendance during that time slot, and the price charged for
attendance in that time slot. Each movie (which can be either a trailer, feature, or
commercial) is identified by a Movie ID and further described by its title, duration,
and type (i.e., trailer, feature, or commercial). In each time slot, one or more
movies are shown. The owners want to also keep track of in what sequence the
movies are shown (e.g., in a time slot there might be two trailers, followed by two
commercials, followed by a feature film, and closed with another commercial).
Solution
Ch4-P8 : Mid 2014, Mid 2013 (Normalization)
Table shows a relation called GRADE REPORT for a university.

a) Draw relational schema and diagram functional dependencies in the relation.


b) In what normal form is this relation?
c) Decompose GRADE REPORT into a set of 3NF relations.
d) Draw a relational schema for your 3NF relations and show the referential
integrity constraints.
e) Draw your answer to part d using Microsoft Visio (or any other tool
specified by your instructor)
Solution

a)

b)

c)
d)

e)
Null : Final 2019 (Normalization)
Identify any repeating groups and functional dependences in the PATIENT
relation. Show all the intermediate steps to derive the third normal form for
PATIENT.
PATIENT(patno,patname,gpno,gpname,appdate,consultant,conaddr,sample)

Solution

a) 1NF

Patient (patno, patname, gpno, gpname)


Appt (patno, appdate, consultant, conaddr, sample)

b) 2NF

Patient (patno, patname, gpno, gpname)


Appt (patno, appdate, consultant, sample)
Consultant (consultant, conaddr)

c) 3NF

Patient (patno, patname, gpno)


GP (gpno, gpname)
App (patno, appdate, consultant, sample)
Consultant (consultant, conaddr)
Null : Final 2016 (Normalization)
We consider the following relation:
Articles(ID,title,journal,issue,year,startpage,endpage,TR-ID)

It contains information on articles published in scientific journals. Each article has


a unique ID, a title, and information on where to find it (name of journal, what
issue, and on which pages). Also, if results of an article previously appeared in a
“technical report” (TR), the ID of this technical report can be specified. We have
the following information on the attributes:

• For each journal, an issue with a given number is published in a single year.
• The endpage of an article is never smaller than the startpage.
• There is never (part of) more than one article on a single page.
The following is an instance of the relation

Solution

• Keys:
{ID,TR-ID}
• FDs :
Journal, issue → year
ID → title, journal, issue, startpage, endpage
• Relations:
Articles1(journal, issue, year)
Articles2(ID, title, journal, issue, startpage, endpage)
Articles3(ID,TR-ID)
Ch4-P13 : Section Ex (Normalization)
The Public Safety office at Millennium College maintains a list of parking tickets
issued to vehicles parked illegally on the campus. Table 4-6 shows a portion of this
list for the fall semester. (Attribute names are abbreviated to conserve space.)

a) Convert this table to a relation in first normal form by entering appropriate


data in the table. What are the determinants in this relation?
b) Draw a dependency diagram that shows all functional dependencies in the
relation, based on the sample data shown
c) Give an example of one or more anomalies that can result in using this
relation.
d) Develop a set of relations in third normal form. Include a new column with
the heading Violation in the appropriate table to explain the reason for each
ticket. Values in this column are: expired parking meter (ticket code1), no
parking permit (ticket code 2), and handicap violation (ticket code 3).
e) Develop an E-R diagram with the appropriate cardinality notations.

Solution

a)
b)

c)

d)

e)
Ch4-P9 : Example (Normalization)
Table 4-5 shows a shipping manifest. Your assignment is as follows:
a) Draw a relational schema and diagram functional dependencies in the
relation.
b) In what normal form is this relation?
c) Decompose MANIFEST into a set of 3NF relations.
d) Draw a relational schema for your 3NF relations and show the referential
integrity constraints.
e) Draw your answer to part d using Microsoft Visio (or any other tool
specified by your instructor).

Solution

a)

b)
c)

d)

e)

You might also like