Level
|
Rule
|
2 conditions:
An entity type is in 1NF when (A) it contains no repeating groups of data. (This is typically already implied in sql server, unless you have varchar type to hold an array of data, say "blot/screw/ for product field, which represents all products for a specified store. Also xml data type could hold array of data) And (B) it is not allowed to have duplicated rows. (this can be done easily with a primary key of a table). It has to have a primary key, otherwise it will allow duplicate data, which violates 1NF. Also repeated data comes with mixing up 2 entities into 1 tables, such as AccountOrder type table. or Inventory table where both product and store information is stored in this table. |
|
An entity type is in 2NF when it is in 1NF and when
all of its non-key attributes are fully dependent on its primary key. That is, partial dependance (for example, depend on only one of composed primary key field) is not allowed. Typically dimensional tables in OLAP database only normalized to 2ND. However, fact tables are generally normalized to 3NF. |
|
An entity type is in 3NF when it is in 2NF and when all of
its attributes are directly dependent on the
primary key. That is, non-key attributes depend ONLY (Solely) on primary key, nothing else.
If Store table contains Product column. Since product does depend on store since it specifies the product is manufactured by that store. However product does not depend ONLY on store. So this is 2NF, not 3NF table. To make a 3NF table, we need to create a new table Product. |
Sunday, 8 January 2012
normalization definition
Subscribe to:
Post Comments (Atom)
Requiring existence of "the key" ensures that the table is in 1NF; requiring that non-key attributes be dependent on "the whole key" ensures 2NF; further requiring that non-key attributes be dependent on "nothing but the key" ensures 3NF.
ReplyDeletekey means primary key from the definition above.
ReplyDeleteExample:
Product, Store, Inventory (link table with ProductID/StoreID).
OLAP only goes to 2nd normal form for dimension table.