数据库规范化

发布于 2024-10-11 23:26:39 字数 779 浏览 2 评论 0原文

我的任务是标准化这组数据:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦中楼上月下 2024-10-18 23:26:39

您认为 3NF 的依据是什么?

让我们举一个非常简单的例子,Course。如果他有功能依赖,那么他到底在哪里,在什么键上?当 CourseDurationCourseFee 依赖于 CourseName 时,CourseName 如何依赖于 CourseId > ?

与其余表相同; Event 稍微复杂一点,有更多错误。

当您的出发点是将 ID 贴在所有移动的物体上时,您就无法标准化或实现 3NF。

不。首先对数据进行标准化。达到 3NF。我可以将 CourseCodeShortName 理解为用户可以用来识别课程的内容,但没有 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 can CourseName be dependent on CourseId, when CourseDuration and CourseFee are dependent on CourseName ?

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 or ShortName as something the user may use to identify course, but no Id.

After that, if and only if you need to, add an Id column and the additional index.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文