[英]Database Normalization
I've been given the task of normalizing this set of data: 我已经完成了标准化这组数据的任务:
COURSE=(CourseID, CourseName, CourseDuration, CourseFee{
DelegateID, DelegateName, DelegateAddress, EventID, EventName, VenueID, VenueName, VenuePrice, BookingID, BookingType, BookingDate
})
The scenario is an IT company that runs short training courses at various hotels around the country, each event being hosted by one or more presenters (hence the BookingType - either Delegate or Presenter, if Presenter then no booking charge). 该方案是一家IT公司,该公司在全国各地的多家酒店举办短期培训课程,每次活动都由一个或多个演示者主持(因此,BookingType-代表或演示者,如果演示者则无需付费)。 An event is just an instance of a course running at a particular venue.
事件只是在特定场所运行的课程的一个实例。 VenuePrice refers to the cost for optional bed and breakfast at the hotel venue for the intervening nights
VenuePrice是指在此期间晚上在酒店场地购买可选床和早餐的费用
Here is what I have come up with for 3NF: 这是我为3NF设计的:
COURSE=(CourseID, CourseName, CourseDuration, CourseFee)
DELEGATE=(DelegateID, DelegateName, DelegateAddress)
EVENT=(EventID, VenueID*, CourseID*, EventName, EventDate)
BOOKING=(BookingID, DelegateID*, EventID*, BookingDate, BookingType)
VENUE=(VenueID, VenueName, VenuePrice)
I'd like to know if this is at all accurate, and if not, perhaps a guiding hand in the right direction? 我想知道这是否完全正确,如果不正确,也许是朝正确方向的指导手?
Thanks 谢谢
On what basis do you think that is in 3NF ? 您认为3NF是基于什么?
Let's take a really simple example, Course
. 让我们举一个非常简单的示例
Course
。 Where exactly if he Functional Dependency, on what key ? 如果他在功能上依赖,到底在哪里呢? How can
CourseName
be dependent on CourseId
, when CourseDuration
and CourseFee
are dependent on CourseName
? 如何
CourseName
取决于CourseId
,当CourseDuration
和CourseFee
取决于CourseName
?
Same with the rest of the tables; 与其余表相同;
Event
being a little more complex, has a few more errors. Event
稍微复杂一点,还有一些错误。
You cannot normalise, or achieve 3NF, when your starting point is to stick an ID
on everything that moves. 当您的起点是在移动的所有物体上贴上
ID
时,您就无法归一化或达到3NF。
No. First normalise the data . 否。首先将数据标准化。 Achieve 3NF.
达到3NF。 I can understand a
CourseCode
or ShortName
as something the user may use to identify course, but no Id
. 我可以将
CourseCode
或ShortName
理解为用户可以用来标识课程的某种东西,但是没有Id
。
After that, if and only if you need to, add an Id
column and the additional index. 之后,仅在必要时添加
Id
列和其他索引。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.