简体   繁体   English

数据库规范化的第一种形式?

[英]First form of database normalization?

I have an ER diagram that I want normalize. 我有一个要标准化的ER图。 But I'm not sure if I normalize it correctly. 但是我不确定是否正确地对其进行了规范化。 Do I need to include every primary key to table the columns? 我是否需要包括每个主键才能列出这些列?

这是我的数据库ER图

And here is my SQL Server code for my table. 这是我的表的SQL Server代码。 I'm not sure if this correct: http://rextester.com/BCA95581 我不确定是否正确: http//rextester.com/BCA95581

According to Wikipedia , a relation (table) is in first normal form: 根据Wikipedia所述 ,关系(表)的格式为第一种形式:

First normal form (1NF) is a property of a relation in a relational database. 第一范式(1NF)是关系数据库中关系的属性。 A relation is in first normal form if and only if the domain of each attribute contains only atomic (indivisible) values, and the value of each attribute contains only a single value from that domain. 当且仅当每个属性的域仅包含原子(不可分割)值且每个属性的值仅包含该域中的单个值时,关系才采用第一范式。 The first definition of the term, in a 1971 conference paper by Edgar Codd, defined a relation to be in first normal form when none of its domains have any sets as elements. 1971年,埃德加·科德(Edgar Codd)的会议论文中对该术语的第一个定义是,当一个关系的任何域都没有任何集合作为元素时,该关系应为第一范式。

So just the raw structure as you show it in the ER diagram doesn't really suffice to know if the tables are in 1NF - it depends on the domain and the possible data types. 因此,仅显示在ER图中的原始结构实际上不足以知道这些表是否位于1NF中-它取决于和可能的数据类型。 Just make sure that 只要确保

(1) each attribute (column in every table) can only hold atomic values (no arrays, lists, objects, comma-separated values etc.) (1)每个属性(每个表中的列)只能保存原子值 (没有数组,列表,对象,逗号分隔的值等)

(2) no column can ever hold more than 1 of these values (2)没有列可以容纳超过1个这些值

If you're using the basic data types of SQL Server, then you should be fine. 如果您使用的是SQL Server的基本数据类型,那应该没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM