0

In a relation schema, if:

  1. an attribute appears only on the left side then it is prime.
  2. an attribute appears only on the right side then it is non-prime.

But what happens when there are attributes in the middle? Are they prime if they are a subset of the key?

philipxy
  • 14,867
  • 6
  • 39
  • 83
Mauricio
  • 433
  • 5
  • 15

2 Answers2

1

Start from scratch with what you think a prime attribute is, because your definition is incomplete.

For an attribute to be prime, is has to be part of a candidate key. Now, in your case, it happens that A is prime and the rest are not (Since the only candidate key is A). But take this scenario: F={ {A->C}, {B->C}, {C->D}, {D->AB} }. In this case, there are two candidate keys: AB, and D.

This means that A, B, and D are all prime, since they are all parts of candidate keys, and C is not.

Pablo Prado
  • 185
  • 3
  • 11
  • That was my mistake... I was only using the definition that says that it is prime if only appears at the left side, which is also true, but that's only a specific case. Thank you – Mauricio Apr 17 '15 at 19:31
0

Could you give an example? I think I know what your confusion is, but I need more context to answer properly. I can think of 3 things you are referring to:

1) If you mean something like:

AB -> CD

and you think A is prime and D is non-prime, that's not what "left" and "right" means. Everything on the left of the arrow is prime, and everything to the right of it is non-prime.

2) Further, your point 1 is incorrect. An attribute only has to appear left once to be prime. BUT!!!!!! It also depends left or right of what. Are you talking about dependencies of candidate keys only, or all dependencies? To finish my answer I need to have a bit more context.

Pablo Prado
  • 185
  • 3
  • 11
  • Hi, thank you for answering, lets say F={ {A->B}, {B->C}, {C->D} } In this case, A is prime, and D is not... but what happens to B and C ? I am talking about functional dependencies within a relational schema to find the candidate keys. My question regards of what happens to the ones in the middle so I can use the 2NF and 3NF definitions, are they prime ? – Mauricio Apr 16 '15 at 01:18
  • I wrote an answer that ended up being way too long, so let's do this instead. Start from scratch with what you think a prime attribute is, because your definition is incomplete. For an attribute to be prime, is has to be part of a candidate key. Now, in your case, it happens that A is prime and the rest are not (Since the only candidate key is A). But take this scenario: F={ {A->C}, {B->C}, {C->D}, {D->AB} }. In this case, there are two candidate keys: AB, and D. This means that A, B, and D are all prime, since they are all parts of candidate keys, and C is not. – Pablo Prado Apr 17 '15 at 01:50