-1

I am not sure if this statement is true or false: "A table with a single attribute primary key is automatically in at least second normal form (2NF)."

I think it is TRUE but I cannot justify why.

philipxy
  • 14,867
  • 6
  • 39
  • 83
Prova12
  • 643
  • 1
  • 7
  • 25
  • 3
    No, that's wrong. A single column primary key, does not even guarantee 1NF –  Apr 09 '19 at 10:09
  • 1
    What can it possibly mean for you to say you think it's true while having no justification? PS It's false. If some non-prime column must have the same value in every row then {} partially functionally determines that column & the table is not in 2NF. However that is a common myth because people forget about {} as a determinant. – philipxy Apr 09 '19 at 12:17
  • @a_horse_with_no_name ["1NF" has no single meaning.](https://stackoverflow.com/a/40640962/3404097) But all the meanings are essentially irrelevant to modern normalization theory. They just disallow certain table values that have nothing to do with anything else in normalization theory. – philipxy Apr 09 '19 at 12:28
  • PS Moreover, read a definition of 2NF. All non-prime columns must be fully functionally dependent on *every* CK, not just one. That's probably what your instructors want you to notice, because they probably ascribe to the myth that all CKs simple implies 2NF. Also PKs don't matter, CKs do. If you mean that the premise includes that there is only one CK then you should say so. PS Give your definition of 2NF. It might or might not also care about some version of "1NF". – philipxy Apr 09 '19 at 12:43
  • Please show & justify the steps of your work following a published academic textbook & ask a specific question where stuck. Right now you are just asking for us to rewrite your textbook/manual with a bespoke tutorial & do your (home)work & you have shown no research or other effort. Dumps of requirements are not on-topic questions. See [ask], hits googling 'stackexchange homework' & the voting arrow mouseover texts. – philipxy Apr 09 '19 at 13:02
  • This is a duplicate. Before considering posting please always google your error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names, & read many answers. If you post a question, use one phrasing as title. See [ask] & the voting arrow mouseover texts. – philipxy Apr 09 '19 at 13:15
  • 2
    Does this answer your question? [when a 1NF table has no composite candidate keys is it in 2NF?](https://stackoverflow.com/questions/10936387/when-a-1nf-table-has-no-composite-candidate-keys-is-it-in-2nf) – philipxy Jul 27 '21 at 23:44

2 Answers2

-1

For a table to be in first normal form,an attribute of a table cannot have multiple values

For example ,

id   mobile_number   age
------------------------------
1    9xxx5xxxxx      25
     9xxx6xxxxx      
2    8xxxx5xxxx      26 
     7xxxx5xxxx      

This can be normalized to 1NF as follows,

id  mobile_number  age
------------------------------------
1   9xxx5xxxxx     25
1   9xxx6xxxxx     25
2   8xxxx5xxxx     26 
2   7xxxx5xxxx     26 

A table is said to be in second normal form if the table is in the first normal form and no non-prime attributes depend on a proper subset of any candidate key

Here candidate key is {id,mobile_number}

Non prime attribute is age

The table is not in 2NF because the non-prime attribute(age) is dependent on proper subset of candidate key(id) alone.

To normalize this to 2NF,we split the table as follows

id   mobile_number
------------------------------
1    9xxx5xxxxx
1    9xxx6xxxxx
2    8xxxx5xxxx
2    7xxxx5xxxx

id age
------
1  25
2  26  
  • If you ask the question poster to give their definition of 2NF you are likely going to find that it doesn't care about 1NF. ["1NF" has no single meaning.](https://stackoverflow.com/a/40640962/3404097) See my comments on the question. – philipxy Apr 09 '19 at 12:34
  • This answer does not answer the question since it does not address the assumption of "A table with a single attribute primary key". PS "For a table to be in first normal form,an attribute of a table cannot have multiple values" implies every table is in 1NF, because by definition a relational table has one value per column per row. You are a victim of one of the many confused & unhelpful presentations of a "1NF". See my link re 1NFs. – philipxy Apr 09 '19 at 12:50
-1

If relation schema R already is in 1NF and primary key has only one attribute then that relation R at least must be in 2NF.

  • This is a poor answer because (1) it doesn't explain/justify & (2) it is wrong. Read [this correct answer](https://stackoverflow.com/a/10940117/3404097) at the link to the question that the comment suggests it is duplicate of. (The "Does this answer your question?" comment is automatically generated when someone flags a question as a dupllciate.) Also read the rest of the comments on the question. Please always read the comments when reading posts. – philipxy Mar 18 '22 at 23:27
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 19 '22 at 03:37