gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Questions re database schema - normalization


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Questions re database schema - normalization
Date: Fri, 3 Sep 2004 10:03:56 +0200
User-agent: Mutt/1.3.22.1i

> >select.. natural join ..on ..  mechanism suggests
> >it's better to have a unique id name for each entity
> 
> I think we have fields named simply "id" in some tables.
most, actually, and simply "pk" in the others

> Does this mean that
>    if a join should have to operate on 2 tables
>    selecting from each a field named "id"
> that the syntax will stumble
No. It is IMO advisable anyways (and in most case inavoidable)
to be explicit, eg. join on table1.id = table2.id or table1.pk
= table2.pk, eg qualified field names.

> and/or it is unwanted/extra work to 
> have to provide aliases so as to be able to distinguish the column 
> names and data from the two "id" fields in the output?
Doing a join on id doesn't automatically include that field in
the select list. IF both are in the select list, they should
be aliased appropriately (as we do profusely in views).

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




reply via email to

[Prev in Thread] Current Thread [Next in Thread]