📜  DBMS中1NF和3NF的区别

📅  最后修改于: 2021-08-24 04:37:56             🧑  作者: Mango

1.第一范式(1NF):
没有任何重复列或数据组的实体可以称为“第一范数”。 1NF是第一范式,它为规范化关系数据库提供了最低限度的要求。符合1NF的表可确保它实际上表示一种关系(即,它不包含任何重复的记录),但是没有1NF的通用定义。一个重要的属性是,符合1NF的表不能包含任何具有关系值的属性,即所有属性都应具有原子值。

要遵循的一些规则是:

  • 应该为表中的每个属性指定一个唯一的名称。
  • 它不应包含任何复合属性。

例子 :

ROLL NUMBER STUDENT NAME MARKS
1 Arpit 78
2 Ayush 68
3 Arjun 89

由于此关系不包含任何复合或多值属性,因此该关系为1NF。

2.第三范式(3NF):
这意味着如果表/实体已经处于第二范式并且该表/实体的列非传递性地依赖于主键,则该表被认为是第三范式。

如果存在传递依赖项,我们可以通过将属性与一个行列式副本一起放置在新的关系中,从而从该关系中删除该传递依赖项属性。大多数3NF表都没有插入,更新和删除操作异常。 3NF用于减少数据重复并获得数据完整性。

示例:考虑关系R(E,F,G,H,I)

E -> FG, 
GH -> I, 
F -> H, 
I -> E 

上述关系中所有可能的候选键为{E,I,GH,FG}所有属性在所有功能依赖项的右侧,都是素数。

1NF和3NF之间的区别:

S.No. 1NF 3NF
1. In order to be in 1NF any relation must be atomic and should not contain any composite or multi-valued attributes. In order to be in 3NF there should be no transitive dependency that is no non prime attribute should be transitively dependent on the candidate key.
2. The functional dependency is not necessary for first normal form. In 3NF the functional dependencies are already in 1NF and 2NF.
3. 1NF is considered less stronger normal form. 3NF is considered as a stronger normal form than the 1NF.
4. 1NF contains candidate keys which automatically comply with 2NF. 3NF form will require decomposing a table that is in the 2NF or 1NF.
5. It eliminate duplicate columns from the same table. It remove columns that are not dependent upon the primary key.
6. It take less computational time. It takes more computational time.
7. The goal of the first normal form is to ensure that there are no repeating groups of data. The goal of the third normal form is to ensure referential integrity.
8. There are No Composite Attributes. There are No Transitive Functional Dependencies.