when a 1NF table has no composite candidate keys is it in 2NF?

白昼怎懂夜的黑 提交于 2019-12-19 09:05:44

问题


Is it safe to say, when a 1NF table has no composite candidate keys (primary keys consisting of more than one column), the table is automatically in 2NF?

Can a table voilate 2NF, when it has only one column in its primary key?


回答1:


A relvar R, is in 2NF as long as there is no non-trivial FD, A->B, satisfied by R where B is nonprime and where A is a proper subset of some candidate key of R.

You first have to consider all the candidate keys. If it is the case that all the candidate keys happen to be single attribute keys then the only possible proper subset of any of those keys is {} (the empty set). Dependencies on the empty set are unlikely to arise unintentionally because they are usually obvious and unnecessary. Such dependencies are perfectly possible however, even where there is only a single, simple key.




回答2:


Yes, the table can violate 2NF when it has only one column in its primary key. The basic idea of 2NF is to have all the fields of your table directly dependent/related to the primary key. The example that @A B gives explains the same point.




回答3:


The key to having a individual table in 2NF is to "Remove subsets of data that apply to multiple rows of a table and place them in separate tables."

If a table has multiple rows that repeat information, then that information should be moved to another table and a relationship established though the use of foreign keys.

http://databases.about.com/od/specificproducts/a/2nf.htm



来源:https://stackoverflow.com/questions/10936387/when-a-1nf-table-has-no-composite-candidate-keys-is-it-in-2nf

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