Nullable Foreign Keys?
From: Jesper <no_at_spam.com>
Date: Mon, 13 Sep 2004 15:24:35 +0200
Message-ID: <41459f8d$0$289$edfadb0f_at_dread12.news.tele.dk>
I have 3 tables: TUsers, TUserGroups, TUserGroupMembers. Now I want to create a new table TPermissions which needs to contain information about what a user or a usergroup has permissions for in my application. To that end I'm thinking something like:
nPermissionID
nUserID
nUserGroupID
...
Date: Mon, 13 Sep 2004 15:24:35 +0200
Message-ID: <41459f8d$0$289$edfadb0f_at_dread12.news.tele.dk>
I have 3 tables: TUsers, TUserGroups, TUserGroupMembers. Now I want to create a new table TPermissions which needs to contain information about what a user or a usergroup has permissions for in my application. To that end I'm thinking something like:
TPermissions
nPermissionID
nUserID
nUserGroupID
...
where the 2 last columns are foreign keys into TUsers and TUsergroups. The
point being that each permissionitem must/can have *either* nUserID *or*
nUserGroupID. Is this bad design? One of them will always be NULL. Is there
a better way to implement something like this?
Jesper.
Received on Mon Sep 13 2004 - 15:24:35 CEST