Midterm exam

advertisement
IS 4420 Mid Term Exam Solutions
Part A:
1)
2)
3)
4)
5)
D
D
A
C
C
6) B
7) D
8) D
9) D
10) D
11) A
12) A
13) C
14) D
15) D
16) C
17) B
18) FALSE
19) TRUE
20) FALSE
21) FALSE
22) TRUE
23) TRUE
24) FALSE
25) FALSE
Part B:
1. (10 points) Draw E-R diagram for the following situation. A university has a large
number of courses in its catalog. Attributes of COURSE include Course_Number
(identifier), Course_Name, and Units. Each course may have one or more different
courses as prerequisites, or may have no prerequisites. Similarly, a particular course may
be a prerequisite for any number of courses, or may not be prerequisite for any other
course.
1
2. (15 points) For the relational schema along with the functional dependencies below
partial functional dependency
partial functional dependency
Transitive dependency
a. (5 points) Identify all the partial functional dependencies and transitive
dependencies if any by writing on the functional dependencies above.
b. (2 points) Circle the right normal form of this relation: 1NF
2NF
3NF
c. (8 points) Draw a relational schema in 3NF, show referential integrity constraints
and functional dependencies.
2
3. Suppose we have already created two tables and insert some data into them based on
the information below.
Table Name: department
Attribute
Department Name
Department Number
Manager SSN
Manage Start Date
Data Type
VARCHAR(15)
INT
CHAR(9)
DATE
Primary
Foreign

Constraint
NOT NULL
NOT NULL
NOT NULL
Table Name: dept_locations
Attribute
Data Type
Primary
Department Number
INT

Department Location
VARCHAR(15)

Foreign
Constraint
Department (DepNo) ON
NOT NULL
DELETE CASCADE
NOT NULL
Table Name: Department
DName
Manufacture
Administration
Headquarter
DepNo
1
2
3
MgrSSN
888665555
543216789
554433221
MgrDate
19-JUN-71
04-JAL-99
22-SEP-55
Table Name: Dept_Locations
DepNo
1
1
2
2
3
DLocation
Houston
Chicago
New York
San Francisco
Salt Lake City
3
a. (5 points) Write the SQL command to delete the Manufacture department from
the Department table.
DELETE from department where dname='Manufacture';
b. (5  2 = 10 points) After you deleted the Manufacture department from the
Department table, please show the results of the following two SQL commands.
SELECT depno, dname from department;
DEPNO
2
3
DNAME
Administration
Headquarter
SELECT depno, count(depno) from dept_locations group by depno;
DEPNO
2
3
COUNT(DEPNO)
2
1
4
Download