Re: Normalization questions...

From: Barry <BarryJJ_at_ATTGlobal.Net>
Date: Sun, 21 Jan 2001 12:19:02 -0500
Message-ID: <3a6b1bf4_3_at_news1.prserv.net>


pavel wrote:

> Hi,
> I am building a generic database editor for webpages... and I am confused.
> How do you deal with tables without keys?

If you mean relational tables, then by definition you have to have a key or it isn't relational.

> Ok from start, I have users table, which has uid as primary key for the
> record, then there is other table, groups with gid as a key in it.
> In between there is table that has two fields gid and uid, that basically
> ties two tables, those fields are indexed. However the third table does
> not have key field. To locate records within database editor I use keys,
> to locate a specific record. As far as I understand RDBMS theory you
> should not "UPDATE" items in KEY fields.

The implementation design goal is a Primary Key that *never* changes, and you only use PKs as FKs.

That does not preclude other unique identifiers (i.e., candidate keys in the logical model) from being updatable as needed.

> If I edit the linking record however, there are no unique keys, so it
> should not be too much of a problem. But it does collide with what I know
> about databases.

As described, either (gid,uid) is the key, and a compound key at that ... or, if that is not the case, you need to rethink your design.  

> So my main question is, should I expect a user to provide a record ID for
> each table, even though it might be not needed, in order for it to be
> editable, or should I just go against my intuition?

Don't confuse what you use as the implementation primary key in the data base with what the user might see as the unique identifier. In my models, the implementation PK is a surrogate, but the users only ever see the candidate keys 'coz those are the business identifiers.

HTH ... Barry J. Received on Sun Jan 21 2001 - 18:19:02 CET

Original text of this message