从 2 个表开始的星型模式

发布于 2024-12-18 12:53:46 字数 212 浏览 2 评论 0原文

有人可以向我解释一下如何创建一个以 2 个表开头的星型模式,例如包含 StudentID、地址、城市、州、邮政编码的学生表和包含描述、学分、费用和日期的班级表吗?

据我所知,您从每个表中获取主键并将它们作为外键放入事实表中,但是有没有办法让一个实际的星号包含 5 个表,从 2 个表开始?

如果我添加一个名为 Professor 的表,它会被视为维度表还是日期表会被视为维度表?

Can someone please explain to me how you would create a star schema starting with 2 tables, for example a Student table with StudentID, Address, City, State, Zip and class table with description, credits, fees and date?

I understand that you take the primary keys from each table and put them as a foreign key in the facts table, but is there a way to have an actual star with 5 tables, starting with 2 tables?

If I added a table called Professor would that be considered a dimension table or would the date table be a dimension table?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

小矜持 2024-12-25 12:53:46

需要明确的是:星型模式可以包含任意数量的维度表(星型点)。它不一定是 5。

事实表表示(如您所说)保存所有其他表的外键的关系或事务。在这种情况下,您的事实表将类似于“classesTaken”、“classSection”或“enrollment”。您还可以添加“教授”表(因为班级的每个实例都需要一位教授)和/或“日期”表(从您的班级表标准化)来提供注册日期。

这将为您提供一个包含 4 个星“点”的事实表。如果您真的一心想要一个类似于五角星的模式,我相信您可以考虑添加另一个维度表。希望有帮助。

Just to be clear: A Star schema can consist of any number of dimension tables (points of the star). It doesn't have to be 5.

The facts table represents the relationship or transaction that (as you said) hold foreign keys to all of the other tables. In this case, your facts table would be something like "classesTaken", "classSection" or "enrollment". You could also add tables for "Professor" (because each instance of a class will need a professor) and/or a "Date" table (normalized from your Class table) to give enrollment dates.

That would give you a fact table with 4 "points" of a star. If you were really bent on having a schema that resembled a 5-pointed star, I'm sure you could think of another dimension table to add. Hope that helps.

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