Uploaded by shwkt Mohamed Moahmed Elshahd

Sheet 2- Conceptual Modeling and Daatabase Design - Solutions

Fayoum University
Faculty of Engineering
Electrical Engineering Dept.
Computer & Systems Eng. Section.
Database Fundamentals. I (CCE307)
Dr. Sayed Taha
Sheet 1 (Relational Model Concepts) - Solutions
1- Conceptual questions: 2- A database is being constructed to keep track of the teams and games of a sports league. A
team has a number of players, not all of whom participate in each game. It is desired to keep
track of the players participating in each game for each team, the positions they played in
that game, and the result of the game. Design an ER schema diagram for this applicatio n,
stating any assumptions you make. Choose your favorite sport (e.g., soccer, baseball,
The following design may be used for a baseball league. Here, we assumed that each game in the
schedule is identified by a unique Game#, and a game is also identified uniquely by the combination
of Date, starting Time, and Field where it is played. The Per formance attribute of PARTICIPATE is
used to store information on the individual performance of each player in a game. This attribute can
be designed to keep the information needed for statistics, and may be quite complex. One possible
design for the Performance attribute may be the following:
Performance( {Hitting(AtBat#, Inning#, HitType, Runs, RunsBattedIn, StolenBases)},
{Pitching(Inning#, Hits, Runs, EarnedRuns, StrikeOuts, Walks, Outs,
Balks, WildPitches)},
{Defense(Inning#, {FieldingRecord(Position, PutOuts, Assists, Errors)})} )
Here, performance is a composite attribute made up of three multivalued components: Hitting, Pitching,
and Defense. Hitting has a value for each AtBat of a player, and records the HitType (suitable coded;
for example, 1 for single, 2 for double, 3 for triple, 4 for home run, 0 for walk, -1 for strikeout, -2 for fly
out, ...) and other information concerning the AtBat. Pitching has a value for each inning during which
the player pitched. Defense has a value for each inning a player played a fielding position. We can
have a less detailed or a more detailed design for the performance of a player in each game,
depending on how much information we need to keep in the database. Suitable variations of the ER
diagram shown below can be used for other sports.
3- Consider the ER diagram shown in Figure 1 for part of a BANK database. Each bank can have
multiple branches, and each branch can have multiple accounts and loans.
a) List the strong (nonweak) entity types in the ER diagram.
b) Is there a weak entity type? If so, give its name, partial key, and identifying relationship.
c) What constraints do the partial key and the identifying relationship of the weak entity type
specify in this diagram?
d) List the names of all relationship types, and specify the (min, max) constraint on each
participation of an entity type in a relationship type. Justify your choices.
e) List concisely the user requirements that led to this ER schema design.
f) Suppose that every customer must have at least one account but is restricted to at most two
loans at a time, and that a bank branch cannot have more than 1,000 loans. How does this
show up on the (min, max) constraints?
(b) Weak entity type: BANK-BRANCH. Partial key: BranchNo.
Identifying relationship: BRANCHES.
(c) The partial key BranchNo in BANK-BRANCH specifies that the same BranchNo value ay occur
under different BANKs. The identifying relationship BRANCHES specifies that BranchNo values
are uniquely assigned for those BANK-BRANCH entities that are related to the same BANK entity.
Hence, the combination of BANK Code and BranchNo together constitute a full identifier for a
(d) Relationship Types: BRANCHES, ACCTS, LOANS, A-C, L-C. The (min, max) constraints
are shown below.
(e) The requirements may be stated as follows: Each BANK has a unique Code, as well as a Name
and Address. Each BANK is related to one or more BANK-BRANCHes, and the BranhNo is unique
among each set of BANK-BRANCHes that are related to the same BANK. Each BANK-BRANCH
has an Address. Each BANK-BRANCH has zero or more LOANS and zero or more ACCTS. Each
ACCOUNT has an AcctNo (unique), Balance, and Type and is related to exactly one BANKBRANCH and to at least one CUSTOMER. Each LOAN has a LoanNo (unique), Amount, and
Type and is related to exactly one BANK-BRANCH and to at least one CUSTOMER. Each
CUSTOMER has an SSN (unique), Name, Phone, and Address, and is related to zero or more
ACCOUNTs and to zero or more LOANs.
(f) The (min, max) constraints would be changed as follows:
4- Consider the BANK ER schema of Figure 1, and suppose that it is necessary to keep track of
(CAR_LOANS, HOME_LOANS, ...). Suppose that it is also desirable to keep track of each
account's TRANSACTIONs (deposits, withdrawals, checks, ...) and each loan's PAYMENTs;
both of these include the amount, date, time, ... Modify the BANK schema, using ER and EER
concepts of specialization and generalization. State any assumptions you make about the
additional requirements.
5- Figure 2 shows an example of an EER diagram for a small private airport database that is used
to keep track of airplanes, their owners, airport employees, and pilots. From the requireme nts
for this database, the following information was collected: Each airplane has a registratio n
number [Reg#], is of a particular plane type [of_type], and is stored in a particular hangar
[stored_in]. Each plane_type has a model number [Model], a capacity [Capacity], and a weight
[Weight]. Each hangar has a number [Number], a capacity [Capacity], and a location
[Location]. The database also keeps track of the owners of each plane [owns] and the
employees who have maintained the plane [maintain]. Each relationship instance in owns
relates an airplane to an owner and includes the purchase date [Pdate]. Each relations hip
instance in maintain relates to an employee to a service record [service]. Each plane undergoes
service many times; hence, it is related by [plane_service] o a number of service records. A
service record includes as attributes the date of maintenance [Date], the number of hours spent
on the work [Hours], and the type of work done [Workcode]. We use a weak entity type
[service] to represent airplane service, because the airplane registration number is used to
identify a service record. An owner is either a person or a corporation. Hence, we use a union
type (category) [owner] that is a subset of the union of corporation [Corporation] and person
[Person] entity types. Both pilots {Pilot] and employees [Employee] are subclasses of person.
Each pilot has specific attributes license number [Lic_Num] and restrictions [Restr]; each
employee has specific attributes salary [Salary] and shift {Shift]. All person entities in the
database have data kept on their social security number [Ssn], name [Name], address [Address],
and telephone number [Phone]. For corporation entities, the data kept includes name [Name],
address [Address], and telephone number [Phone]. The database also keeps track of the types
of planes each pilot is authorized to fly [Flies] and the types of planes each employee can do
maintenance work on [Works_on]. Show how the small airport EER schema of Figure 2 may
be represented in UML notation. (Note: We have not discussed how to represent categories
(union types) in UML, so you do not have to map the categories in this and the following
6- Figure 3 shows an ER schema for a database that can be used to keep track of transport
ships and their locations for maritime authorities. Map this schema into a relational schema
and specify all primary keys and foreign keys.
7- Consider the EER diagram in Figure 4 for a car dealer. Map the EER schema into a set of
relations. For the VEHICLE to CAR/TRUCK/SUV generalization and show the relationa l
schema design under each of those options.
Below mapping for the Generalization part
Let them complete the remaining part considering that the <SALE> relation is ternary relation.
Random flashcards

20 Cards


30 Cards


46 Cards

Create flashcards