数据库规范化SQL

问题描述 投票:-1回答:1

我需要将此表规范化为第3范式。清楚地显示0NF,1NF,2NF和3NF的阶段。陈述您可以做出的任何假设使用关系符号表示法.Normalisation

我在这项任务中做了以下假设:'确定一个所有者可以拥有多只宠物。一只宠物可以去散步。

ONF R1 = (Owner #, Owner Name, Owner Phone, {Pet#, Pet Name, Walk Date, Walk Duration, Paid, Walk Notes})

1NF-

R11 = (Owner #, Owner Name, Owner Phone)
R12 = (Pet #, Owner #, Pet Name, Walk Date, Walk Duration, Paid, Walk Notes)

2NF
R11 = (Owner #, Owner Name, Owner Phone)
R12 = (Pet #, Owner #, Pet Name, Walk Date, Walk Duration, Paid, Walk Notes)
R121 =(Pet #, Owner #, Pet Name)
R122 = (Pet #, Walk Date, Walk Duration, Paid, Walk Notes)

3NF
Already in 3NF as no transitive dependencies exist.

只是想看看这是否正确?

database-design relational-database database-normalization
1个回答
0
投票

你没有任何传递依赖但是

---所有初始关系均为0NF

--- 1NF:

每个表格单元格应包含单个值。

每条记录都必须是唯一的。

--- 2NF你应该分开步行和宠物以避免冗余:因为如果你插入没有步行会话的新宠物,你有4列没有价值。对于1000新宠物来说,这将是不好的。更新和删除步行会话是如此糟糕

R1 = (Owner#, Owner Name, Owner Phone)
R2 = (Pet#, Pet Name,Paid, Owner#,Walk#)
R3 = (Walk#, Walk Date, Walk Duration, Walk Notes)
© www.soinside.com 2019 - 2024. All rights reserved.