Answer to Lecture Assignment No.2

9.12

SHIP(SName, Owner, Type, S_C_Name, PName)
    PK: SName
    PK: Type that references SHIP_TYPE.Type
            S_C_Name, PName that reference PORT.S_C_Name, PORT.PName respectively.

SHIP_MOVEMENT(SName, Date, Time, Longitude, Latitude)
    PK: SName, Date, TimeA
    FK: SName that references SHIP.SName

SHIP_TYPE(Type, Tonnage, Hull)
    PK: Type

STATE_COUNTRY(Name, Continent)
    PK: Name

SEA_OCEAN_LAKE(Name)
    PK: Name

PORT(S_C_Name, PName, S_O_L_Name)
    PK: S_C_Name, PName
    FK: S_C_Name that references STATE_COUNTRY.Name
           S_O_L_Name that references SEA_OCEAN_LAKE.Name

VISITS(S_C_Name, PName, SName, StartDate, EndDate)
    PK: S_C_Name, PName, SName, StartDate
    FK: S_C_Name, PName that reference PORT.S_C_Name, PORT.PName respectively.
           SName that references SHIP.SName.
 

14.26

Calculate the closure of {A, B} under the given functional dependencies set.
{A, B}+ = {A, B, C, D, E, F, G, H, I, J}  Therefore {A, B} is a super key.

Calculate the closure of {A} and{ B} under the given functional dependencies set.
{A}+ = {A, D, E, I, J}
{B}+ = {B, F, G, H}

Therefore, {A, B} is a minimal superkey. i.e. a Key for the relation R.

The original relation R is not in 2NF because there are some partial dependencies.
Decompose the relation R into:

R1(A, B, C)
    PK: A, B
    FK: A that references R2.A
           B that references R3.B

R2(A, D, E, I, J)
    PK: A

R3(B, F, G, H)
    PK: B

All R1, R2 and R3 are relations in 2NF.

However, relation R2 is not in 3NF because the non-key attributes I and J are functionally dependent on another non-key attribute D.
Similarly, relation R3 is not in 3NF either because the non-key attributes G, H are functionally dependent on another non-key attribute F.
We need to further decompose relation R2 and R3 into:
R21(A, D, E)
    PK: A
    FK: D that references R22.D

R22(D, I, J)
    PK: D

R31(B, F)
    PK: B
    FK: F that references B32.F

R32(F, G, H)
    PK: F