Re: [Maypole] Maypole::Plugin::Relationships and YAML

From: Dana Hudes (dhudes at hudes.org)
Date: Tue Feb 01 2005 - 23:17:21 GMT


On Tue, 1 Feb 2005, Peter Speltz wrote:

>
> --- Dana Hudes <dhudes at hudes.org> wrote:
>
> >
> >
> > >
> > > > Use id as primary key...
> >
> > With Sebastian, and nobody else including major works on database theory,
> > ontology, semantics....you don't see Ullman writing schema with 'id'.
> > Nor Codd. I don't believe Tim Berners-Lee used that as an identifier
> > in his work on the Semantic Web.
> >
>
> Why is id recommended for all PK's? I'm guessing it makes something convenient
> but i haven't found what. CDBI users and some old database programmers from 8
> years back are only people i've heard to say this.

I have a BS and MS in CS. My coursework and experience includes database
theory circa 1989. I have here a copy of Jeffrey Ullman's _Principles of
Database Knowledge-Base Systems, vol. 1_ from 1988. I am a former and
hopefully future CS Professor; I nearly taught Database systems but as an
adjunct I decided to pass on setting up and maintaining an Oracle server.
Before punting, I did select the textbook based on what everyone else
(Columbia, Cornell ,SUNY Stony Brook) was doing...and the textbook of
choice was a current edition of Ullman (I see in my collection that
somehow I didn't get a copy of that book...must've switched to Programming
Languages and not bothered...I do have -quite- the collection of books on
Programming Languages).

I took my copy of Ullman's book from grad school off the shelf and flipped
it open to the chapter on "Design Theory for Relational Databases".
Its got a lot of stuff to say. One of them is avoiding redundancy.

>From a documentation perspective, if I have a PK that I then use as a FK
somewhere, gosh but it makes life so much clearer to use the same name.

If the name is 'id', you're screwed. Oh sure you could use the name of the
table whose PK you've got...but this is awkward, now you've got a column
the same name as a table that is confusing.

beer_id is ok. beerId is ok. beerIdentifier is more typical of XML.
Probably want to avoid "beernumber" its not something you want to do
arithmetic on yourself.

I submit that what you have is properly called an index. Call it beerIndex
(watch out, INDEX is a SQL keyword however you *can* have a column named
"index" which is almost as bad as "id").

Oh, btw I am running a blog these days and my adventures in database,
Maypole, Perl, YAML and knowledge representation as well as systems admin
and whatever else comes to mind are recorded therein.

http://www.hudes.org/blog

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT