1NF到底是什么? [英] What is 1NF truly?

查看:290
本文介绍了1NF到底是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在研究关系数据库时,我遇到了


While studying relational databases, I ran into this confusing page where the following snapshot summarizes my confusion:

Why does the author say that Subject Table is in 1NF when student_id 401 and subject Math is repeated in the same way the blue depicts? This seems like a contradiction.

解决方案

The key concept this page fails to mention is that the data contained in the row must not be duplicated, meaning that a single key value cannot have multiple values for a single column. The real problem is that for student id of 401, the first table specifies the name twice.

The text following the last table should read "In Subject table concatenation of subject_id and student_id is the primary key". The reason the new subject table is okay is because the key is actually both of these values, so while 401 is repeated, the key is 10, 401 and 11, 401, which are two distinct values. Likewise, math is repeated, but it is the data for two separate keys; it isn't repeated within a row. Because these key values are different, it is okay.

The page you referenced doesn't give a very precise definition. I hope this explanation helps. Keep checking other sites to get a more clear understanding. Wikipedia has a good example and a precise definition, though it is a bit abstract and hard to follow. http://en.wikipedia.org/wiki/First_normal_form

这篇关于1NF到底是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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