Role-playing dimensions
Give an orders fact order-date and ship-date foreign keys that both reference one shared date dimension.
Concept
role-playing-dimensions
The primary modeling idea this problem reinforces.
Requirements
3
Business needs the model must satisfy.
An orders fact needs both an order date and a ship date for cycle-time analysis. A teammate is about to create dim_order_date and dim_ship_date as separate tables.
Role-playing dimensions reuse one physical dimension in multiple semantic roles through multiple foreign keys. Separate date tables drift apart and break conformance; multiple FKs to one date dimension keep the calendar consistent.
- Add an orders fact with an order_date foreign key and a ship_date foreign key.
- Point both foreign keys at the one existing date dimension surrogate key.
- Keep both relationships at N:1 to the shared date dimension.
Template
Role-playing date starter
The model users start from in the full workspace.
Entities
1
Seeded tables visible in the public preview.
Dialect
postgresql
Generated SQL target for this starter model.
This preview is read-only. Open the workspace to edit and verify; saving needs a free account.
Open workspaceTry the question first.
The discussion has other people's approaches and solutions. Give it a real attempt before you read them.