Design Challenge #1 - Having the same primary key in two or more logical entities

The general scenario

You are a data modeler designing a data mart, and have come across at least two different entities on your logical data model that happen to have the same primary key. On your physical data model, would you keep them in separate tables or merge them into a single table because these entities share the same key? Don’t answer just yet! I’m not looking for a response such as “separate tables” or “single table”. I’m looking for a set of guidelines on when to go which route. Read on for the specifics. Thanks to Ben Ettlinger for providing the idea behind this scenario.

The detailed scenario

In your role as data mart data modeler, you have identified the following two main questions this data mart must answer:

  • What are our company’s actual expenses by department and month?

  • What are our forecasted expenses by department and month?

So your Actual Expense and Forecasted Expense logical entities look something like this (primary keys are above the line):

What should the physical entity (or entities) look like if the primary key to both of these entities is the Month and Department? What I’m looking for is not just an answer, but guidelines on when to choose which design. Imagine you are writing these guidelines for someone with minimal data modeling experience. Guidelines can be in the form of if-then-else logic, for example:

If the Actual expense amount and Forecasted expense amount are always being used together on reports, and they change at roughly the same rate

And....

Then they should be in one table, and look like this:

Else if the rate of change....

And....

Then they should be kept separate and look like this:

Guidelines can also be in the form of a flowchart or spreadsheet, whatever medium you think is most conducive to explaining the options. Let your imagination run on this one. There are no restrictions and no wrong answers.

 

To read the response to this design challenge, please click here