I rarely come across a situation where one table for several types of entities seems better than one table for an entity type. Here is an example that makes sense to me, but in an academic sense, this seems wrong.
QUESTION: Can I do this and still have a “sound” architecture?
Example:
Suppose there are two types of entities, a corporation and a person. A corporation is usually owned by a person, but sometimes another corporation owns the corporation.
Holding on to this thought and adding to it, let’s say that every corporation has a registered agent who is responsible for the legal establishment of the corporation. Continuing my illustration, a registered agent can be either a person or a corporation.
If you think that the owner [parent] of the corporation [subsidiary] can be either a person or a corporation, you can start considering the problem of maintaining the third normal form and avoiding redundancy.
Unlike my example, if only people can own the Corporation, the Ownership link table is very conditional, having columns: OwnershipID (sort of unnecessary), CorporateID, PersonID.
Instead, you need something like: OwnershipID, CorporateID, OwnerID, OwnerEntityType (corp or person). Don't get me wrong, you can do this job, but at least it won't be fun.
, , . (). . , ( ). .
"" , , CPA - biz, . , -, - -. . [ , , CorporateEntity)
, () , , : AgentRepresentationID, CorporateID, AgentID, AgentType... , (IMO), - Person, .
: , . :
: EntityAll
: EntityID, EntityType ( EntityTypeID, , , ), EntityName ( ... )
:
Key Columns: OwnershipID ( , , ), ChildEntityID (, , "Child" , ) ParentEntityID ( )
: AgentRepresentation
: AgentRepresentationID (... ), CorporateEntityID ( corp), AgentEntityID ( Entity, , )
, . . , , (-, , , ). , , , , .
, , . EntityAll , , .
( T-SQL):
SELECT Corp.EntityName as CorpName, Owner.EntityName as OwnerName
FROM EntityAll as Corp
JOIN CorporationOwnership as Link on (Corp.EntityID = Link.ChildEntityID)
JOIN EntityAll as Owner on (Link.ParentEntityID = Owner.EntityID)
, , ().
, , , , .
P.S. SO. , . , .
/:
db: