Re: Nullable Foreign Keys?

From: Laconic2 <laconic2_at_comcast.net>
Date: Mon, 13 Sep 2004 10:03:11 -0400
Message-ID: <mr6dnbgJG81dNdjcRVn-rw_at_comcast.com>


"Jesper" <no_at_spam.com> wrote in message news: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.
>
>

It seems to me that a "user" is just a special case of a "usergroup". It's a group with only one member.

Try a search on "generalization specialization relational design".

If that doesn't produce anything interesting, try another search on "user roles privileges relational design."

HTH. Received on Mon Sep 13 2004 - 16:03:11 CEST

Original text of this message