Normal Form - 4th Normal Form

江枫思渺然 提交于 2019-12-23 06:10:22

问题


I have this data that I need to put into 3rd and 4th Normal Form.

I understand the basics of normal form but I'm confused with 3rd and 4th normal form and I've checked online but still don't understand.

I'm creating a database which is being used by my system.


回答1:


A relation in 4NF is also in BCNF, 3NF and the lower NFs.

From this answer:

A superkey is a set of columns that uniquely identifies rows.

A candidate key is a set of columns that uniquely identifies rows and that contains no smaller ("proper") subset of columns that uniquely identifies rows.

So a candidate key is a superkey that contains no smaller superkey.

A multi-valued dependecy (MVD) X ->> Y holds in a table (ie a table has that MVD) with attribute set R when the table can be expressed as the join of the two tables that are its projections on attribute sets X U Y and X U (R - Y). (Because an MVD is a binary join dependency (JD)).

From Wikipedia:

A trivial multivalued dependency X ->> Y is one where either Y is a subset of X, or X and Y together form the whole set of attributes of the relation.

A Table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X ->> Y, X is a superkey—that is, X is either a candidate key or a superset thereof.

Every table has a predicate, ie a statement template parameterized by the table's attribute names, where the rows that go in the table are the ones that make a true statement by replacing attribute names in the predicate by the corresponding attribute values in the row. The MVD X ->> Y holds in a table when its predicate P can be rephrased as:
         FOR SOME values for the attributes not in X U Y, P
     AND FOR SOME values for the attributes not in X U (R - Y), P

So let your table's meaning be your guide to CKs, superkeys and MVDs. To normalize from BCNF to 4NF: If a non-trivial MVD X ->> Y not out of a superkey holds then replace the table by its projections on X U Y and X U (R - Y); repeat on the new tables.



来源:https://stackoverflow.com/questions/28743367/normal-form-4th-normal-form

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