Is it true that a database is 2NF by default if the table only has 1 primary key?

谁说胖子不能爱 提交于 2019-12-12 20:40:52

问题


i.e. there is a table with only 1 primary key (no composite keys). Is it 2NF by default? Assume that it is already 1NF


回答1:


http://en.wikipedia.org/wiki/Second_normal_form

in your example, PatNo is not a primary key since PatNo may see more than one doctor, or have more than one appNo.




回答2:


Loosely speaking, a table is in 2NF if and only if it's

  • in 1NF, and
  • there are no partial key dependencies.

That's not quite the same thing as saying a table that has a single-column primary key is in 2NF. A table like this

person_id  full_name       phones
--
-43        Ericka Cimini   555-222-1515
                           555-232-6100
-18        Julio Martina   555-123-4567

has a single-column primary key ("person_id"), but it isn't in 1NF. (See wikipedia for details.) And since it's not in 1NF, it can't possibly be in 2NF.




回答3:


I think got it now.

In my example if there is more than 1 doctor, then doctor is also partially dependent on the patient number because the doctor has to see the correct patient. It's just confusing because doctor is also transitively dependent to patNo via appNo.




回答4:


Maybe this late response might be helpful to others. We were taught (perhaps mistakenly) that irrelevant data also fell under 2NF. So animal(phylum, class, order, family, genus, species, greek_phoneme) would not be in 2NF because Greek phonemes have nothing to do with Animals.



来源:https://stackoverflow.com/questions/10235566/is-it-true-that-a-database-is-2nf-by-default-if-the-table-only-has-1-primary-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!