English 中文(简体)
该表是否适合2NF?
原标题:does this table fit for the 2NF?

a 学生选择课程表。

 studentnumber   name     age     selected course   credit

    1             tom      23            math           5

    2              jim      20          computer         4

........

如果该表适合2NF,为什么和如何纠正。 谢谢。

最佳回答

它不是2个NF。 这是:

Students:

studentnumber   name     age    

1               tom      23            
2               jim      20     

课程:

coursenumber   name      credit

1              math      5
2              computer  4

Student_课程:

studentnumber  coursenumber

1              1
2              2

因为你想要打破并非完全依赖原候选人钥匙(例如课程和学生人数)的属性。 赛义布仅部分依靠外国候选人的钥匙(例如,信贷依赖课程,而不是学生)。 年龄和姓名取决于学生,但不是课程。 对于每个部分受抚养人,你创建了一个新表格,使法尔的属性完全取决于新的候选人/主要钥匙。

问题回答

样本中没有足够的数据来说明所有决定因素。

从我们对学生和课程的了解来看,学生人数决定了学生的姓名和年龄,而且选定课程也决定了信贷。 假设(人数,选定课程)是表上的关键候选人,也是合理的。 这都是根据每个人以往在学生和课程方面的经验进行的。

另一项答复提供了正确的解决办法,但采用新的数据项目,即“序号”对于将数据输入2NF并非绝对必要,条件是没有两个课程可以有相同的“选修课程”。 然而,发明课程数目可能是一个好的想法。





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签