I am developing a table of ownerships for files. Personal files could be possessed by whether single user (table Customers) or several customers (table UserGroups). I must get this to whole relationship as you table, where each tuple will be an group's possession or perhaps a user's possession of the file.
Customers: User_ID(PK), title, email
UserGroups: UserGrp_ID(PK), title, creator_ID(FK to Customers)
I believe you can do both associations as you table, but I am not quite sure how. It's also acceptable if Customers or UserGroups tables have to change (still within the planning stage).
- allow NULL on FK posts
- give a CHECK CONSTRAINT to make sure that certain of these is non-null:
ALTER TABLE dbo.MyTable ADD CONSTRAINT CK_MyTable CHECK (Column1 IS NOT NULL OR Column2 IS NOT NULL) GO
OwnerID = PartyID(
OwnerIdis really a role title of
PartyIDwithin the File table).
UserID = PartyID(
UserIDis really a role title of
PartyIDwithin the User table.)
GroupID = PartyID(
GroupIDis really a role title of
PartyIDwithin the Group table.)
Possess a table with (File,OwnerID (int),OwnerType(Char(1))
Where OwnerID may either be UserID or GropuID and OwnerType may either Be ('G' - Group or 'U' - User)
Possess a table with (File,OwnerID,GroupID) in which a touple which has OwnerID populated joins towards the user table along with a tuple with GroupID populated joins towards the Groups table.