概念模型按一年链接多个表

发布于 2025-01-25 14:26:49 字数 701 浏览 0 评论 0原文

这也许是一个非常基本的问题,但是我正在尝试建模一些东西,理想情况下是使用Start模式。我提供了一些虚拟数据。

第一张表仅列出每个国家 /地区的“得分”(不太重要)。

第二个桌子一直都有(在所有国家 /地区)的得分总和。

我只是想知道如何对这样的东西进行建模。

国家表

Year Country Score
2022 US      500
2021 China   100
2022 UK      200
2019 UK      150
2019 US      300

总计

Year Country       Score DataCaptured(%)
2019 All Countries 1000  95
2020 All Countries 2000  89
2021 All Countries 4000  89
2022 All Countries 6000  97

我已经开始了。国家表充当“事实”表。我已经创建了一个分开的维度表[countryId,country],并用IDS代替了国家/地区的国家/地区。我还创建了一个年度表[YearId,Year],并在国家/地区用IDS取代了年份。

但是,我不确定如何将总表格带入混合。我需要根据年度专栏将其与其他表链接。用ID替换并将其链接到年份表是否有意义?

This is maybe a very basic question, but I'm trying to model something, ideally with a start schema. I've provided some dummy data.

The first table just lists out "Scores" (not too important what this score represents) for each country by year.

The second table just has the score sum (across all countries) for all years.

I'm just wondering how something like this could be modelled.

Countries Table

Year Country Score
2022 US      500
2021 China   100
2022 UK      200
2019 UK      150
2019 US      300

Totals Table

Year Country       Score DataCaptured(%)
2019 All Countries 1000  95
2020 All Countries 2000  89
2021 All Countries 4000  89
2022 All Countries 6000  97

I've made a start. The countries table acts as a "fact" table. I've created a separated dimension table [countryID, country] and replaced countries in the Countries table with the IDs. I've also created a Year table [YearID, Year] and replaced years in the Countries table with IDs.

However, I'm not sure how to bring the Totals table into the mix. I would need to link it with the other table based on the Year column. Does it make sense to replace the year with an ID and link it to the Years table?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文