问题
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?
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/6788008/warehouse-store-and-count-non-fact-records