Re: does a table always need a PK?

From: Niels Muller Larsen <nml_at_acm.org>
Date: Sun, 24 Aug 2003 22:09:19 +0200
Message-ID: <Pine.LNX.4.53.0308242202290.1661_at_nmlinux.localdomain>


I beg to differ. In that case you would create a table similar to:

create table atom_component (
component_name char(12) not null primary key, no_of_components int not null);

There would be no point of storing individual rows of indistinguishable elements in a table.

 Yours truly

 Niels Müller Larsen

On Sun, 24 Aug 2003, Heikki Tuuri wrote:

> Hi!
>
> I would like to bring up to the discussion what I remarked in the other
> discussion thread on MySQL RDBMSness.
>
> If we have a quantum mechanical system where electrons are
> indistinguishable, would it not be natural to create a table of electrons
> without a primary key?
>
> Best regards,
>
> Heikki Tuuri
> Innobase Oy
>
>
> "--CELKO--" <joe.celko_at_northface.edu> kirjoitti viestissä
> news:a264e7ea.0308231444.3179b3a3_at_posting.google.com...
> > >> do I need to have a primary key in the BOOK table? <<
> >
> > Yes, otherwise it is not a table by definition. Assuming that you
> > have more than one book, use the ISBN as the industry standard
> > identifier and use this table:
> >
> > CREATE TABLE Books
> > (isbn CHAR(10) NOT NULL,
> > page_nbr INTEGER NOT NULL,
> > content TEXT NOT NULL,
> > PRIMARY KEY (isbn, page_nbr));
> >
> > if you had only one book, use its title for the table name:
> >
> > CREATE TABLE "Moby Dick"
> > (page_nbr INTEGER NOT NULL PRIMARY KEY,
> > content TEXT NOT NULL);
> >
> > You are splitting attributes in the original schema. That is, you put
> > the attributes of a book in (n > 1) table, so the data model was not
> > complete.
>
>
>
Received on Sun Aug 24 2003 - 22:09:19 CEST

Original text of this message