Sei sulla pagina 1di 10

DATABASE MANAGEMENT

ASSIGNMENT
(Chapter 5&6)

Submitted to: Mr. Peter Enfestan


Submitted by: Ma. Jessa Aartsen

Transforming an E-R diagram to relations (parts a and b)

c. Using an enterprise key

7. Transforming Table 5-3


to relations: a.

b. 1NF
c.

d.

e.

15. All relations are in 3NF since there are no partial functional
dependencies or transitive dependencies. It could be argued that zip
code is determined by city and state (also by address with 9-digit
zip codes). This could be a good point to discuss in class.

CHAPTER 6

(1,19)

Answers:

a. On general considerations indexes will be defined on primary


and/or foreign key. Thus in this situation it should be
speedup the query.
b. STUDENT_ID in STUDENT because it is a primary key and the index
would enforce uniqueness of the key; also, STUDENT_ID in STUDENT
and in REGISTRATION is used in a WHERE clause for joining the
STUDENT and REGISTRATION tables, so it likely makes sense to create
an index on STUDENT_ID in REGISTRATION as well.
GPA in STUDENT because it is a nonkey cluster attribute used to qualify
record retrieval STUDENT_NAME in STUDENT because it is a nonkey
attribute used to sort records

STUDENT_ID, COURSE_ID in REGISTRATION because it is a


concatenated primary key and the index would enforce
uniqueness of the key
CREATE UNIQUE INDEX STUPKINDX ON STUDENT (STUDENT_ID);
CREATE INDEX STUDREGINDX ON REGISTRATION (STUDENT_ID);
CREATE INDEX CLUST_INDX
ON STUDENT (GPA)
CLUSTER;
CREATE INDEX NAMEINDX ON STUDENT (STUDENT_NAME);
CREATE UNIQUE INDEX REGSPKINDX ON REGISTRATION
(STUDENT_ID, COURSE_ID);
Assuming that Vendor_ID and Price hold data that fits the two byte field
size:
Vendor_ID
SMALLINT
Address
VARCHAR(40)
Contact_Name
VARCHAR(25)
Item_ID
INTEGER
Description
VARCHAR(35)
Price
SMALLINT
The answer to this question will vary for different universities, but
common situations are used here. Since the majority of students are
accepted in the first year after high school graduation and university
attendance is increasing, the average age of students in the first year
of college would be a good choice for a default value. Often students
are accepted at the different schools within the university after the
second year. Therefore we need to add two years to the first answer if
we design the system for a business school, for example. Degree
seeking students are generally younger than non-degree seeking
students, and the default value for this field might be a higher number
for non-degree seeking students. Graduate students have already
completed a degree, which usually takes at least four years, so a
graduate university would also use a higher default value.
Since every student who hasn't explicitly declared a major of his or her
choice would be assigned this value, it should be considered a default
value. The null value is an empty value.

19.

Answers:

An index on the State field of the customer table would help with
grouping and sorting. An index on Order_Date in the order table would
help with qualifying to the desired period. If rows are sorted by
description within state, it would seem that a index on Product
_Description in the product table might be helpful, but such an index
would likely not be used by most DBMSs because the number of rows
to sort within each category is so few.
An index on Product_Finish in the Product table would help to compute
the totals by product finish.
An index on Order_Date would help to quickly find the desired orders,
and an index on Order_ID in the order line table would speed
joining.
An index on Product_Line_ID in product would speed grouping, and an
index on Product_ID in the order line table would speed joining.

Potrebbero piacerti anche