问题
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