仓库:存储(和计数)非事实记录?

发布于 2024-11-26 07:16:30 字数 113 浏览 2 评论 0原文

如何存储不包含任何事实的记录?例如,假设一家商店想要统计有多少人进入商店(并且他们获取进入商店的每个人的信息)。在仓库中,我猜想会有具有不同属性的维度表“Person”,但是事实表会是什么样子呢?它只包含外键吗?

How to store records that don't contain any fact? For example, let's say that a shop wants to count how many people have entered inside a store (and that they take info on every person that goes inside the shop). In warehouse, I guess there would be dimension table "Person" with different attributes, but how would fact table look like? Would it contain only foreign keys?

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

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

发布评论

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

评论(2

走野 2024-12-03 07:16:30

正如您所描述的,这只是一个事实表。实际上,这个有一个名字——无事实的事实表;没有任何措施的事实表。

重新编码事件很常见。本质上,任何记录:谁、什么、哪里、何时以及为什么? 的内容都将是无事实测量的表。如果您添加多少?,那么这将成为一个度量。

As you described it, that would be just a fact table. Actually, there is name for this -- factless fact table; fact table without any measures.

It is quite common for recoding events. Essentially anything that records: who, what, where, when and why? would be fact-measure-less table. If you add how much? then that goes into a measure.

人海汹涌 2024-12-03 07:16:30

您可以将其视为包含隐式计数列的事实表,其中包含进入的人数,如果您在个人级别存储数据,则该事实表始终为“1”,因此这使得事实表仅包含维度的 FK。

当然,这只能对进入的人数进行分析,并针对各个维度进行过滤,但对我来说,这似乎是一个现实的用例。我认为你走在正确的道路上。

You can think of it as the fact table containing an implicit count column, with the number of people entering, which is always "1" if you store data on individual person level, so that makes a fact table containing only FKs to the dimensions.

This of course only enabled analysis on the number of people entering, filtered for the various dimensions, but it seams like a realistic use case to me. I think you're on the right way.

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