when the 1NF table does not have composite candidate keys, is it in 2NF?

Is it possible to say with certainty that if there are no composite candidate keys in the 1NF table (primary keys consisting of more than one column), the table automatically becomes 2NF?

Can a table invalidate 2NF if there is only one column in its primary key?

+4
source share
3 answers

A segment R is in 2NF if there is no non-trivial FD, A-> B, satisfied by R, where B is not primary and where A is a proper subset of some candidate key R.

First you need to consider all the candidate keys. If it is so that all candidate keys are single attribute keys, then the only possible correct subset of any of these keys is {} ( empty set ). Dependencies on an empty set are unlikely to occur unintentionally, because they are usually obvious and not needed. Such dependencies are quite possible, even if there is only one simple key.

+2
source

Yes, a table can violate 2NF if there is only one column in its primary key. The main idea of ​​2NF is that all the fields in your table are directly dependent / related to the primary key. The example that @AB gives explains the same point.

0
source

The key to having a separate table in 2NF is "Delete the subsets of data that apply to multiple rows of the table and put them in separate tables."

If the table has several rows that repeat the information, then this information should be transferred to another table and establish a relationship using foreign keys.

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

-1
source

Source: https://habr.com/ru/post/1416635/


All Articles