移动到第二个窗体 [英] Moving to second form

查看:165
本文介绍了移动到第二个窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们怎么创建这个表的第二种形式(主要是:{egbn,copy}):

isbn AB-1234-X

authorID IC45

authorName I.Conn

标题最后的窗帘>
复制 2

分类侦测功能

userID xyz44

解决方案

关系在2NF iff




  • 在1NF中,并且

  • 每个非素数属性是
    ,取决于每个
    候选键的整体(不在
    的任何候选键的一部分) )



唯一的候选键是{isbn,copy}。所以问题就成了三个问题。


  1. 这个关系在1NF?

  2. 非素数属性
    {authorID,authorName,title,
    classi fi cation,userID}只依赖于{isbn}

  3. -prime属性
    {authorID,authorName,title,
    classi fi cation,userID} only only
    on {copy}?

b




然后我创建单独的表与
属性:isbn,autorID,autorName,
标题,分类和另一个
表,其属性为:isbn,copy,
userID。


是。在关系发言中,您用这两个投影替换了原始关系R.




  • R 1 = { isbn,复制
    userid}

  • R 2 = { isbn
    作者姓名,标题,分类}



如果你这样做了,你应该可以再次创建R在{isbn}上加入R 1和R 2,



现在两个R< 1< / sub >和R 2 <2>在2NF中。 (我认为这是作业问题的要点。)您可能需要考虑R 1 和R 2 是否在




  • 3NF

  • BCNF

  • 4NF

  • 5NF






稍后。 。



非正式地说,一个关系在3NF iff




  • 它在2NF,而

  • 没有传递依赖。



当我说它是在2NF,我的意思是这个关系在2NF 它不是已经在3NF,BCNF,4NF或5NF。



什么正常形式是R< 1>和< 2> 2< / sub>你会想解释你的推理,否则你的讲师有责任让你看起来很愚蠢。我们不想要这样




  • R 1 = { isbn,复制
    userid}

  • R 2 = { isbn ,authorid,
    authorname,title,classification}



而且稍后。 。 。



R 1 在5NF。 R 2 在2NF中。



R 2 不在3NF中,因为 isbn和authorname。




  • isbn-> authorid,

  • authorid-> authorname



通过用这两个投影替换R 2 来删除此传递依赖关系(R < sub>和R 4 )。




  • R 1 = { isbn,copy ,userid}(5NF)

  • R 3 = { isbn ,authorid,title,classification}

  • R 4 = { authorid ,authorname}



我认为标题和分类之间不存在功能依赖关系。


Guys, how would you create second form of this table (primary key is: {isbn,copy}):
isbn AB-1234-X
authorID IC45
authorName I.Conn
title The final curtain
copy 2
classification Detectivefiction
userID xyz44

解决方案

A relation is in 2NF iff

  • it's in 1NF, and
  • every non-prime attribute is dependent on the whole of every candidate key (not on just part of any candidate key)

The only candidate key is {isbn, copy}. So the question becomes three questions.

  1. Is this relation in 1NF?
  2. Are any of the non-prime attributes {authorID, authorName, title, classification, userID} dependent only on {isbn}?
  3. Are any of the non-prime attributes {authorID, authorName, title, classification, userID} dependent only on {copy}?

What do you think?


Later . . .

Then I'm creating separate table with attributes: isbn, autorID, autorName, title, Classification and another table with attributes: isbn, copy, userID.

Yes. In "relational speak", you replaced the original relation R with these two projections.

  • R1 = {isbn, copy, userid}
  • R2 = {isbn, authorid, authorname, title, classification}

If you've done that correctly, you should be able to create R again by joining R1 and R2 on {isbn}.

Now both R1 and R2 are in 2NF. (I think that was the point of the homework question.) You might want to consider whether R1 and R2 are in

  • 3NF
  • BCNF
  • 4NF
  • 5NF

Still later . . .

Speaking informally, a relation is in 3NF iff

  • it's in 2NF, and
  • there are no transitive dependencies.

When I say "it's in 2NF", I mean the relation in question is in 2NF and it's not already in 3NF, BCNF, 4NF, or 5NF.

What normal form are R1 and R2 in? You'll want to explain your reasoning, otherwise your lecturer is liable to make you look foolish. And we don't want that.

  • R1 = {isbn, copy, userid}
  • R2 = {isbn, authorid, authorname, title, classification}

And still later . . .

R1 is in 5NF. R2 is in 2NF.

R2 isn't in 3NF, because there's a transitive dependency between "isbn" and "authorname".

  • isbn->authorid, and
  • authorid->authorname

Remove this transitive dependency by replacing R2 with these two projections (R3 and R4).

  • R1 = {isbn, copy, userid} (5NF)
  • R3 = {isbn, authorid, title, classification}
  • R4 = {authorid, authorname}

I don't think there's a functional dependency between title and classification.

这篇关于移动到第二个窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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