Tut 4 With Answer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Tutorial 4

1. Define each of the following terms:


a. determinant f. composite key
b. functional dependency g. relation
c. transitive dependency h. normal form
d. recursive foreign key i. partial functional dependency
e. normalization j. enterprise key
2. Match the following terms to the appropriate definition
1. well-structured a. constraint between two attributes
relation b. functional dependency between the primary key
2. anomaly and a nonkey attribute via another nonkey
3. functional attribute
dependency
c. references the primary key in the same relation
4. determinant
5. composite key d. multivalued attributes removed
6. 1NF e. inconsistency or error
7. 2NF f. contains little redundancy
8. 3NF g. contains two (or more) attributes
9. recursive foreign h. contains no partial functional dependencies
key
i. transitive dependencies eliminated
10.relation
11.transitive j. attribute on left side of functional dependency
dependency k. named two-dimensional table of data

3. Describe how the following components of an E-R diagram are transformed


into relations:
a. regular entity type
b. relationship (1:M)
c. relationship (M:N)
d. supertype/subtype
e. multivalued attribute
f. weak entity
g. composite attribute
h. derived attribute
4. The figure shows a class list for Millennium College. Convert this user view
to a set of 3NF relations using an enterprise key. Draw an EER. Assume the
following:
• An instructor has a unique location.
• A student has a unique major.
• A course has a unique title.

5. Given a piece of data, state the dependencies and draw an EER:

6. The materials manager at Pine Valley Furniture Company maintains a list of


suppliers for each of the material items purchased by the company from
outside vendors. Table 4-7 shows the essential data required for this
application.
a. Draw a dependency diagram for this data. You may assume the
following:
• Each material item has one or more suppliers. Each supplier may supply
one or more items or may not supply any items.
• The unit price for a material item may vary from one vendor to another.
• The terms code uniquely identifies the terms of the sale (e.g., code 2
means 10 percent net 30 days, etc. At a given time, a supplier applies a
term code. The terms for a supplier are the same for all material items
ordered from that supplier.
b. Decompose this diagram into a set of diagrams in 3NF.
c. Draw an E-R diagram for this situation.
7. Figure below shows an EER diagram for Vacation Property Rentals. This
organization rents preferred properties in several states. As shown in the
figure, there are two basic types of properties: beach properties and
mountain properties.
a. Transform the EER diagram to a set of relations and develop a relational
schema.
b. Diagram the functional dependencies and determine the normal form for
each relation.
c. Convert all relations to third normal form, if necessary, and draw a
revised relational schema.
d. Suggest an integrity constraint that would ensure that no property is
rented twice during the same time interval.
8. Transform
ransform the diagram into a relation. In addition, verify that the resulting
relations are in 3NF.
Tut 4 Solution
Exercise 1
Define each of the following terms:
a. Determinant The attribute on the left-hand side of the arrow in a
functional dependency.
b. Functional dependency A constraint between two attributes or two
sets of attributes.
c. Transitive dependency A functional dependency between two (or
more) nonkey attributes.
d. Recursive foreign key A foreign key in a relation that references the
primary key values of that same relation.
e. Normalization The process of decomposing relations with anomalies
to produce smaller, well-structured relations.
f. Composite key A primary key that consists of more than one
attribute.
g. Relation A named, two-dimensional table of data.
h. Normal form A state of a relation that results from applying simple
rules regarding functional dependencies (or relationships between
attributes) to that relation.
i. Partial functional dependency A functional dependency in which one
or more nonkey attributes (such as Name) are functionally
dependent on part (but not all) of the primary key.
j. Enterprise key A primary key whose value is unique across all
relations.
k. Surrogate primary key: A serial number or other system assigned
primary key for a relation.
Exercise 2.
f well-structured relation
e anomaly
a functional dependency
j determinant
g composite key
d 1NF
h 2NF
i 3NF
c recursive foreign key
k relation
b transitive dependency

Exercise 3.
a. Normal form; normalization Normal form is a state of a particular
relation regarding functional dependencies, while normalization is
the process of decomposing relations with anomalies to produce
smaller, well-structured relations.
b. Candidate key; primary key A primary key is an attribute (or
combination of attributes) that uniquely identifies a row in a relation.
When a relation has more than one such attribute (or combination of
attributes), each is called a candidate key. The primary key is then
the one chosen by users to uniquely identify the rows in the relation.
c. Partial dependency; transitive dependency A partial functional
dependency exists when a nonkey attribute is functionally
dependent on part (but not all) of a composite primary key; a
transitive dependency is a functional dependency between two or
more nonkey attributes.
d. Composite key; recursive foreign key A composite key is a primary
key that consists of more than one attribute, while a recursive
foreign key is a foreign key in a relation that references the primary
key values of that same relation.
e. Determinant; candidate key A determinant is the attribute on the
left-hand side of the arrow in a functional dependency, while a
candidate key uniquely identifies a row in a relation.
f. Foreign key; primary key A primary key uniquely identifies each row
in a relation, while a foreign key is a primary key in another table.
g. Enterprise key; surrogate primary key An enterprise key is a primary
key whose value is unique across all relations in the whole database
and is likely to hold no business meaning. A surrogate primary key is
a primary key whose value is a serial number or other system
assigned value and is unique to the relation.
Exercise 4.
3NF relations for Millennium College are:
OBJECT(OID,Object_Type)
INSTRUCTOR (OID, Instructor_Name, Instructor_Location)
COURSE (OID, Course_No, Course_Title, Instuctor_Name)
STUDENT (OID, Student_No, Student_Name, Major)
OUTCOME (OID, Student_No, Course_No, Grade)
Exercise 5.
a. Shipment Manifest
3rd Norm:
EER Diagram:

b. License Finement
Exercise 6.

Dependency Diagram

3rd Norm:

EER:
Exercise 7. See Tut 5 Solution
Exercise 8.
Team (TeamID, TeamName, Team Manager)
Participation (RaceID, TeamID, DriverID, PointsEarned)
Driver(Driver_ID,DriverAge,DriverName, TeamID)
Race (RaceID, RaceTittle, RaceLocation, RaceDate)
Finish(DriverID, RC_ID, Position,Result)
RaceComponent(RC_ID, RCType, Race_ID)

You might also like