0

I was very confused by the idea given by my professor when studying about candidate key (but i feel sham to ask him :p )

"no component of K can be eliminated without destroying the uniqueness property --- minimality"

And i searched on wiki it says

"there is no proper subset of these attributes for which (1) holds (which means that the set is minimal)." It also give an example but i don't understand.

So my question is what does the "eliminated" here means? if it means remove the whole rows of data, then it should always keep the uniqueness of the data(because you can't lose uniqueness by removing a row of data). If it means only remove the single attribute of K and left a row with a empty "block", it looks silly and will destroy the data. So can someone give me some simple example for what does this property mean?(maybe one for the good one and one for the bad one) Thank you~

StudioTime
  • 22,603
  • 38
  • 120
  • 207
Ice.Rain
  • 113
  • 2
  • 4
  • 12
  • you could *add* all the functionally dependent columns to the candidate key, without losing its uniqueness property. Your question is about the opposite process: *removing* these fully dependant fields from the key. – joop Oct 31 '16 at 12:57

1 Answers1

3

"Elimination" here does not touch the data at all. It just means that you remove one attribute/column from your key. If that reduced set of columns is still a key (i.e. uniquely identifies any data row), then the previous key was not minimal.

Example:

name id amount
A    1  1000
B    2  2000
C    3  1000

You could use name or id as a minimal key.

You could also use [name, id] as a (compound, multi-column) key. But that key is not minimal (because you can remove one column from it and still have a key).

The column amount in itself does not make a key at all.

[amount, id] would be a key, but again, it is not minimal.

Thilo
  • 257,207
  • 101
  • 511
  • 656
  • Oh thank you very much. i didn't know the idea of compound key before. thank you for the help. And i heard some idea that candidate key is very close to primary key, and prime key is selected from the candidate keys. So in most case they have same property but the primary key is the one chosen by the programmer, is that true? – Ice.Rain Oct 31 '16 at 19:53
  • Yes, a primary key is just one of the possible keys that has been designated as such. Any other key could serve that function. – Thilo Oct 31 '16 at 22:50