|
-
Sep 9th, 2011, 04:24 PM
#1
Data Model - Associate with either of 2 separate entities
Say we have a 'Property' entity. This 'Property' entity can be associated with either a 'Person' entity, or an 'Organization' entity (essentially, the owner of the property), but only one type. How would you implement that in the database? 'Person' and 'Organization' are separate entities with different attributes stored for each.
The foreign key in 'Property' would need to be either a Person id or an Organization id, but it can only have one or the other, so I don't necessarily want to have two separate fields for each. I would rather have a solution that is handled by database constraints, and not extra code written to handle it.
Any ideas? If it matters, I am using SQL Server 2008 R2, but you can be more abstract.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|