第一正常表格和名字和姓氏 [英] First Normal Form and First and Last Names

查看:167
本文介绍了第一正常表格和名字和姓氏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想抓住1NF,我想知道这是下面的表是1NF或不。我将假设没有,因为在colums first_name,last_name和full_name可以重复,因此需要转移到一个新表,其中有列user_id和first_name,last_name和full_name。下图是参考数据库的屏幕截图。

I'm trying to grasp 1NF and am wondering is this following table is 1NF or not. I'm going to assume no because in the colums first_name, last_name, and full_name can be repeated and thus need to be shifted to a new table where there is the columns user_id and first_name, last_name, and full_name. Picture below is a screenshot of the database in reference.

http:/ /imgur.com/kerlB

推荐答案

当然可以。

你对当前设计所说的是,如果是第一个正常的,一个单独的实体(只是称之为一个人)与一个且只有一个用户记录相关联。

What you are saying with your current design, if it is 1st normal is that a single "entity" (lets just call it a person) is associated with one and only one user record.

如果你把名称字段移动到一个单独的表,你基本上说是一个人可以与一个或多个用户记录相关联,并且该人,当更新他们

If you move the name fields into a separate table, what you are basically saying is that a single "person" could be associated with one or more user records, and that the person, when updating their name, should make the same change to all of their "users"

如果您需要这样的结构,表格看起来更像:

If you needed a structure like this, the table would look more like:

user_id|username|password|email|person_id


b $ b

and you would have a separate table for each "person"

person_id|first_name|last_name|full_name

第一个标准不是重复数据。只是看着名字,你很可能有许多人的名字鲍勃或爱丽丝只是因为数据被重复一遍又一遍,不一样说,表有重复的数据。关键是每个记录应该是原子的。

1st normal is not about duplicating data. Just looking at the first name, you very well might have many people with the name "Bob" or "Alice" Just because that data is duplicated over and over again, is not the same as saying that the table has duplicate data. The point is that each record should be atomic.

这篇关于第一正常表格和名字和姓氏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆