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. |