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

后端 未结 3 972
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 09:47

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

相关标签:
3条回答
  • 2020-12-11 09:49

    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.

    0 讨论(0)
  • 2020-12-11 09:57

    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.

    0 讨论(0)
  • 2020-12-11 10:03

    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

    0 讨论(0)
提交回复
热议问题