0

I was going through my lecture slides when I came across this example which I believe is wrong. My lecturer was unable to clarify. I would appreciate it if I could get some clarification.

R = (A, B, C)
Functional Dependencies = (A -> B, B -> A)

The example stated the the highest normal form for the above is 1NF because A-> B forms a partial dependency.

My solution:

AC -> BC (via augmentation axiom)
BC -> AC (via augmentation axiom)

(A,C) and (B,C) are minimal keys and (A, B, C) are prime attributes.

Am I correct to say this:

If (A,C) is the primary key, A -> B is NOT partial FD as RHS is a prime 
attribute. B -> A is a non trivial FD as LHS is not a candidate key.

My lecturer's explanation was that if (A, C) is chosen as the primary key, we dont have to treat (B,C) as a key, if so B is not be a prime attribute, hence partial dependency stands

nic guo
  • 39
  • 1
  • 7
  • 1
    Your justification for A->B being non-partial is wrong. Find a definition of partial FD. Your justification for B -> A being non trivial is wrong. Find a definition of trivial FD. You are confounding those definitions with parts of a definition of 2NF. – philipxy Apr 09 '19 at 13:44
  • So--Where did you look up (the bad definition of) "partial FD"? – philipxy Apr 12 '19 at 03:30
  • Are the two lines after "My solution:" supposed to be justifying the third line? The section is unintelligible. Also you don't show that the 2 superkeys are minimal. – philipxy Apr 12 '19 at 04:40
  • Re "is this right": Show the steps of your work following your reference/textbook, with justification--we want to check your work but not redo it & we need your choices when an algorithm allows them & otherwise we can't tell you where you went wrong & right. See hits googling 'stackexchange homework'. Eg It is not clear what arguments are you summarizing (but not giving) by "as RHS is a prime attribute" & "as LHS is not a candidate key"--so we can't address them. – philipxy Apr 15 '19 at 22:37

1 Answers1

1

Assuming that the given functional dependencies are a cover of all the functional dependencies of the relation schema, the schema presented is in 3NF, as you have found. In fact the only candidate keys are (A, C) and (B, C), so every attribute is prime, and the relation is in 3NF by definition. (Note that the prime attributes depend on the candidate keys, not on a primary key).

In general a dependency X → Y in F+ (the closure of the set of dependencies of the relation) is called partial if Y depends also on a proper subset of X. (More precisely, Y is said partially dependent on X.) And a relation is in Second Normal Form if every non-prime attribute is fully dependent on every candidate key. In this case, you are correct saying that A → B is a non-partial dependency (but not for the reason that B is a prime attribute. For instance, B is not fully dependent on the candidate key A C (because of the existence of the partial dependency A C → B in F+). The fact, however, that B is a prime attribute implies that the schema is in 2NF.

In other words, given the previous definition of partial dependency, concerning this part of your question:

Am I correct to say this:

If (A,C) is the primary key, A → B is NOT partial FD as RHS is a prime attribute. B → A is a non trivial FD as LHS is not a candidate key.

we can say that:

  1. A → B is a non-partial dependency not because B is prime, but because no proper subset of {A} can determine B.

  2. B → A is non-trivial not because the LHS is not a candidate key, but because {A} is not a subset of {B}.

As final note, the relation is not in Boyce-Codd Normal Form. A decomposition that respects that normal form is R1(A, B), R2(A C).

Renzo
  • 26,848
  • 5
  • 49
  • 61
  • Thank you for the clarification – nic guo Apr 09 '19 at 12:53
  • 1
    @nicguo & Renzo A->B is non-partial because no proper subset of A determines B. Prime attributes are irrelevant. They & partial FDs are relevant to 2NF. The other justification by the asker in the question is also wrong. See my comments on the question. Hopefully they could be incorporated into this answer. (And the answer corrected.) – philipxy Apr 09 '19 at 13:45
  • @philipxy Hi philip, thanks for your input. I looked up the definition of Partial Dependency: it occurs when a non-prime attribute is functionally dependent on part of a candidate key. So if the RHS is a prime attribute, wouldnt the dependency definitely not be a Partial FD? And for the non trivial justification I mixed it up with BCNF requirements. Thanks for clarifying – nic guo Apr 09 '19 at 15:19
  • @philipxy my justification for A->B was in relation to the primary key (A,C). So (A,C) does not have any partial dependency. Thanks – nic guo Apr 09 '19 at 15:36
  • 1
    @nicguo Many sources are wrong, including textbooks. Where did you look up "partial FD"? What is its exact definition? And what context is it assuming for that definition? See [this correct answer by me with a quote from a correct textbook](https://stackoverflow.com/a/25827210/3404097). PS X->Y is trivial when X is a superset of Y. – philipxy Apr 09 '19 at 18:07
  • 1
    @nicguo "(A,C) does not have any partial dependency" does not make sense. I guess you are trying to say, (A,C) is not a determinant of a partial FD. PS If {A,C}->{B} & {A}->{B}, the partial FD would be {A,C}->{B}, not {A}->{B}. And in fact {A,C}->{B} *is* partial, but it's not partial & a CK determining a non-prime attribute. – philipxy Apr 09 '19 at 19:03
  • @nicguo Did you google "partial functional dependency" & see "Partial dependency implies is a situation where a non-prime attribute [...]" & just use it--without reading the whole page? If so: That is a *wrong* answer *on the very question that has the correct answer that I wrote & linked*. Read your textbook. Any time you read something on a web page you need to try to vett it--and that includes actually reading the page. – philipxy Apr 09 '19 at 19:41
  • @philipxy thank you for opening my eyes. To sum this up, If (A,C) is the primary key, (A,C) -> B is a partial FD, but since B is a prime attribute it does not violate 2NF (every non prime attribute is fully FD on a primary key). B->A is non trivial as A is not a subset of B, this violates BCNF as it requires all determinants to be a candidate key and B is not. – nic guo Apr 10 '19 at 03:17
  • 1
    @nicguo (A,C) -> B is a partial FD because A->B; CKs & PKs are irrelevant. Then although (A,C) is a CK, B is not non-prime, so (A,C) -> B does not violate 2NF. Ditto for (B,C) & A. (You might even be trying to say that, but you're not. And stop mentioning PKs.) *But that doesn't prove 2NF* because you need to address *all FDs that hold*. BCNF requires every nontrivial FD's determinant to be a *superkey*, ie CK superset. So B->A & A->B *& maybe more* violate. And to get CKs you need to know that your FD set is a *cover*. *Quote & use correct textbook definitions.* And details are important. – philipxy Apr 10 '19 at 04:12
  • Renzo: What reference are you using for what definition of "partial FD"? – philipxy Apr 11 '19 at 06:15
  • @philipxy, I changed the answer. – Renzo Apr 11 '19 at 08:26
  • @philipxy, I follow for instance the definition of D. Maier in “The Teory of Relational Databases”, Computer Science Press, 1983: “Given a set of FDs F and an FD X → Y in F+, Y is partially dependent upon X under F if X → Y is not left-reduced. That is, there is a proper subset X’ of X such that X’ → Y is in F+. If X → Y is left-reduced, then Y is fully dependent on X.” So A → B is not a partial dependency. – Renzo Apr 11 '19 at 08:49
  • Thanks. But that has nothing to do with CKs or prime attributes. It defines the same thing as my definition. But I see you have edited your question to remove the line I complained about. Oh & commented to tell me! PS Re "So A → B is not a partial dependency." Why do you say that? Oh--it is (pointlessly) (correctly) (unsoundly) called full in the question's 1st "Am I right" claim. PS Next I'll read your new version ... Good that you address the 1st "Am I correct" claim but please now the 2nd re "trivial". Per my 1st comment. PS Typo: "( ... `A C → B in F+`)" should be "( ... `A → B in F+`)". – philipxy Apr 11 '19 at 11:19
  • @nicguo & Renzo (Adding to my last comment ot Renzo:) After the last edit the answer still doesn't say that the "Am I right" 1st claim is wrong--the claim is that the FD is full because of a certain reason but the claim is false. And whether the two claims are correct is the question. So this post addresses things the asker's post says but it does not answer either of the two parts of the question it asks! – philipxy Apr 11 '19 at 11:37
  • @philipxy, according to the definition of Maier, is not A->B that is a partial dependency, but AC->B (because of the other dependency). – Renzo Apr 11 '19 at 15:43
  • Renzo: (cc @nicguo--and see recent comments between Renzo & I) Thanks. I misread & I agree re Maier & your post, I thought the post meant to say "B is not fully dependent on the candidate key A C [ie A C → B] (because of the existence of the [unadorned] dependency A → B in F+)". Now your post addresses the "Am I right" misconceptions & gives a correct take on the issues. OK ... After nicguo (rsvp) has a chance to see these comments I'll clean up mine. – philipxy Apr 11 '19 at 23:00
  • (@nicguo &) Renzo Uh... Still two wrong sentences because you wrongly think that a FD with a one-attribute LHS must be full. (You subscribe to a common misconception.) It is only full if FD {} → RHS does not hold, ie if the RHS is not limited to having the same subrow value in every row. So the "since" is wrong in "you are formally correct saying that A → B is a non-partial dependency, since the left part has only one attribute" & the "because" is wrong in point 1's "in a partial dependency the LHS has always more than one attribute." – philipxy Apr 12 '19 at 03:51
  • (@nicguo &) Renzo PS Why "formally" correct? You seem to mean "technically" per an idiom--as in "you're technically correct about that being true--in that you're correct, but 'only on a technicality'--because your reasoning is wrong". But it's not really so obvious that that's what "technically", let alone "formally", means here. Why not just say, "you're correct that that is true, but your reasoning is wrong"? Except this sentence in whatever version is redundant, because you now have point 1. PS I edited some ambiguous "not X" wordings to unambiguous "non-X". – philipxy Apr 12 '19 at 03:59
  • (@nicguo &) Renzo Also "a dependency is non-trivial when the right hand side does not contain any attribute from the LHS" is wrong. Every FD with RHS {} is trivial. Correct is, since it's trivial when the RHS is a subset of the LHS, that it's non-trivial when the RHS is not a subset of the LHS, ie it's non-trivial when the RHS does contain an attribute that is not from the LHS. You negated the wrong thing. PS The way to reduce mistaken phrasings & reasoning is to always start by stating (after memorizing) the relevant definition or theorem then transform to new phrasings or to consequences. – philipxy Apr 12 '19 at 05:11
  • (@nicguo &) Renzo PS (Per my earlier comment:) We're not actually told F is a cover. Either the question is sloppy in not saying so or nicguo doesn't know they need a cover. They apparently know that trivial & non-trivial FDs hold that are not in F, but they don't show sound dealings with a cover/closure re finding CKs & 2NF. (They don't say there can't be any violating non-prime RHSs & they only check one FD per CK.) PS See also my comment on the question re "My solution:". PS This is why questions should not be answered until they show all steps & be stopped at & answered re the first error. – philipxy Apr 12 '19 at 05:29
  • @philipxy, I changed the answer. – Renzo Apr 12 '19 at 09:28