Search code examples
databasenormalizationdatabase-normalization

Couple of normalization questions


My questions are:


1) If I have the relation R(A,B,C), being AB the primary key, and F = {}, may I assume C depends on AB? I'd say no, but I'm asking just to make sure.


2) I'm taking for granted that AB -> CDE is the same as saying AB -> C, AB -> D, AB -> E and as of saying AB -> CE, AB -> D. Am I right?


3) Take R(A,B,C,D), being AB the primary key with F = {AB->C}. Is this in 2NF? I'd say no, as D doesn't depend on any other attribute, let alone the primary key!


4) I'm trying to understand if with

R(K, L, M, N, O,P) 

being KL the primary key

F = { KL->MN, KL->OP, M->N, O->P }

R is in 2NF or 3NF. Both P and N depend (although indirectly) on the whole primary key. Is it enough to be in the 2NF? If it is, I'd say R is not in 3NF as there shouldn't be dependencies between non-prime attributes on a 3NF relation, right?

Thanks


Solution

  • I'm assuming this is homework, so I'm giving direction, not necessarily answers.

    1) If I have the relation R(A,B,C), being AB the primary key, and F = {}, may I assume C depends on AB? I'd say no, but I'm asking just to make sure.

    Do you know how to identify a functional dependency when you're not given any? In this case, you ask yourself this question: "Given values for {A,B}, do those values identify one and only one value for {C}?" If the answer is "yes", you have a functional dependency; if the answer is "no", then you don't.

    2) I'm taking for granted that AB -> CDE is the same as saying AB -> C, AB -> D, AB -> E and as of saying AB -> CE, AB -> D. Am I right?

    I wouldn't say it's "the same as saying". I'd say that from the functional dependency AB->CDE, you can derive all those other functional dependencies.

    3) Take R(A,B,C,D), being AB the primary key with F = {AB->C}. Is this in 2NF? I'd say no, as D doesn't depend on any other attribute, let alone the primary key!

    See number 1.


    Expanding on questions in the comments below . . .

    If you say, {A,B} -> {every other column}, then why aren't all 1NF relations in 2NF?

    Because not every 1NF table has a multi-column primary key, and not every 1NF table that does have a multi-column primary key has other columns determined by only part of that key.

    Imagine a PK being the ID of a person. Now imagine the only other attribute in that relation being the number of ducks found flying in Arizona in '97. There isn't any kind of relationship between A and B in the real world, yet from what you say, one'd assume A -> B.

    Oh, but there is a relationship between those two columns. There's a relationship between them, because you put them in the same table. Within that table, if you know the value for A, then you know one and only one value for B. (If A determined more than one value for B, then A couldn't possibly be the primary key.)