Tutorial 01 Updated 06-10-2015
Tutorial 01 Updated 06-10-2015
1. UPS prides itself on having up-to-date information on the processing and current location of
each shipped item. To do this, UPS relies on a company-wide information system. Shipped
items are the heart of the UPS product tracking information system. Shipped items can be
characterized by item number (unique), weight, dimensions, insurance amount, destination,
and final delivery date. Shipped items are received into the UPS system at a single retail
center. Retail centers are characterized by their type, uniqueID, and address. Shipped items
make their way to their destination via one or more standard UPS transportation events (i.e.,
flights, truck deliveries).These transportation events are characterized by a unique
scheduleNumber, a type (e.g, flight,truck), and a deliveryRoute. Please create an Entity
Relationship diagram that captures this information about the UPS system. Be certain to
indicate identifiers and cardinality constraints. Convert the ER into relational model.
2. A university wants to set up a database to record details about its staff, and the departments
they belong to. They intend to record the following information.
a. For each member of staff, their staff identity number, name, job title, and salary.
b. For each department, its name and address.
c. For each member of staff all departments that they belong to. It is required that
every member of staff belongs to at least one department.
d.
For each department, the head of department. It is required that each department
has exactly one head of department.
Draw an ER diagram that expresses the requirements for the database. Make sure that you
capture all the constraints on the data mentioned above. Convert the ER into relational model.
3. Assume we have the following application that models soccer teams, the games they play, and
the players in each team. In the design, we want to capture the following:
We have a set of teams; each team has an ID (unique identifier), name, main stadium,
and to which city this team belongs.
Each team has many players, and each player belongs to one team. Each player has a
number (unique identifier), name, DoB, start year, and shirt number that he uses.
Teams play matches, in each match there is a host team and a guest team. The match
takes place in the stadium of the host team.
For each match we need to keep track of the following: The date on which the game
is played, the final result of the match the players participated in the match. For each
player, how many goals he scored, whether or not he took yellow card, and whether
or not he took red card. During the match, one player may substitute another player.
We want to capture this Substitution and the time at which it took place.
Each match has exactly three referees. For each referee we have an ID (unique
identifier), name, DoB, years of experience. One referee is the main referee and the
other two are assistant referee.
I.
II.
4. The following narrative describes a simplified version of the organization of Olympic facilities
planned for the summer Olympics. Draw an EER diagram that shows the entity types,
attributes, relationships, and specializations for this application. State any assumptions you
make and map the ERD for the following scenario to create the relational model.
The Olympic facilities are divided into sports complexes. Sports complexes are divided into
one-sport and multisport types. Multisport complexes have areas of the complex designated
for each sport with a location indicator (e.g., center, North East corner, south, etc.). A
complex has a location, chief organizing individual, total occupied area, and so on. Each
complex holds a series of events (e.g., the track stadium may hold many different races). For
each event there is a planned date, duration, number of participants, number of officials, and
so on. A roster of all officials will be maintained together with the list of events each official
will be involved in. Different equipment is needed for the events (e.g., goal posts, poles,
parallel bars) as well as another set of equipment is needed for maintenance of each sports
complex (e.g. cleaning equipment, grass cutters, etc. ). The two types of facilities (one-sport
and multisport) will have different types of information. For each type of facility, there are
number of amenities available (e.g. internet caf, gym, pool, etc.) together with an
approximate budget for each amenity.
5. PART A
A database will be made to store information about patients in a hospital. On arrival, each
patients personal details (name, address, and telephone number) are recorded where possible,
and they are given an admission number. They are then assigned to a particular ward (plastic
surgery, general medicine, pregnancy, cardiac surgery, head and neck). In each ward there are
a number of doctors and nurses. A patient will be treated by one doctor and several nurses
over the course of their stay, and each doctor and nurse may be involved with several patients
at any given time.
I.
II.
Identify the entities, attributes, relationships, and cardinality ratios from the
description.
Draw an entity-relationship diagram showing the items you identified.
Part B
Design The Hospital Database and Tables as follows.
1. Ward Table
2.Nurse
3. Doctor
4. Patient
5. NurseTreatPatient
Part C
Insert the data to the tables as follows.
1. Ward Table
2. Nurse Table
3. Doctor Table
4. Patient Table
5. NurseTreatPatient Table
Part D
Write the sql statements for the followings.
1) List the all tables details.
2) List out the followings.
i) Doctors names
ii) Nurses Names
ii) Wards Names.
iii) Patients Names
3) List out the patients name list who is admitted in ward Number 5(w005)
4) List out the followings
i) List of doctors in ward number 1(w001)
ii) List of Nurses in ward number 5(w005)
ii.
a. Find all loan no. & amount of the Perry ridge branch where the amount is
Greater than 1300
b. Find Customers who are having an account and also having a lone.
c. Find the customers who are having loan, but not having an account.
d. Find total number of customers who are having a account, but not having a loan
e. Find customers who are borrowing loan more than 2000 and amount date higher than
95-01-25
f. Find the total number of amount borrowed
g. Find the maximum and minimum amount that has been borrowed
h. Find the customers whose name begin with letter A and S
i. Find the customers whose name has the pattern NIL
j. List the number of customers with respect to the amount of deposit.