数据库规范化
我的任务是标准化这组数据:
COURSE=(CourseID, CourseName, CourseDuration, CourseFee{
DelegateID, DelegateName, DelegateAddress, EventID, EventName, VenueID, VenueName, VenuePrice, BookingID, BookingType, BookingDate
})
该场景是一家 IT 公司,在全国各地的各个酒店举办短期培训课程,每个活动都由一名或多名演示者主持(因此 BookingType - 代表或演示者) ,如果是演示者则无需预订费)。活动只是在特定场地举办的课程的一个实例。 VenuePrice 指的是中间几晚在酒店场地可选住宿加早餐的费用
以下是我对 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'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). 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
Here is what I have come up with for 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您认为 3NF 的依据是什么?
让我们举一个非常简单的例子,
Course
。如果他有功能依赖,那么他到底在哪里,在什么键上?当CourseDuration
和CourseFee
依赖于CourseName
时,CourseName
如何依赖于CourseId
> ?与其余表相同;
Event
稍微复杂一点,有更多错误。当您的出发点是将
ID
贴在所有移动的物体上时,您就无法标准化或实现 3NF。不。首先对数据进行标准化。达到 3NF。我可以将
CourseCode
或ShortName
理解为用户可以用来识别课程的内容,但没有Id
。之后,当且仅当您需要时,添加
Id
列和附加索引。On what basis do you think that is in 3NF ?
Let's take a really simple example,
Course
. Where exactly if he Functional Dependency, on what key ? How canCourseName
be dependent onCourseId
, whenCourseDuration
andCourseFee
are dependent onCourseName
?Same with the rest of the tables;
Event
being a little more complex, has a few more errors.You cannot normalise, or achieve 3NF, when your starting point is to stick an
ID
on everything that moves.No. First normalise the data. Achieve 3NF. I can understand a
CourseCode
orShortName
as something the user may use to identify course, but noId
.After that, if and only if you need to, add an
Id
column and the additional index.