Re: Database design?

From: "Aasmund Midttun Godal" <postgresql(at)envisity(dot)com>
To: ernst(at)baschny(dot)de
Cc: johnny(at)halfahead(dot)dk, pgsql-general(at)postgresql(dot)org
Subject: Re: Database design?
Date: 2001-10-23 16:42:00
Message-ID: 20011023164200.22669.qmail@ns.krot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can insert values into this structure which have the same id...

INSERT INTO books (id) values (1);
INSERT INTO cds (id) values (1);

Which may be a problem (which may fix :)

Regards,

Aasmund.
On Tue, 23 Oct 2001 16:43:29 +0200, "Ernesto Baschny" <ernst(at)baschny(dot)de> wrote:
> On 23 Oct 2001 at 9:11, Johnny Jørgensen wrote:
>
> rdbm
> book,author,country,cd,publisher)
> therefore can't
> description. Thing
> different
> i've figured
> tables as
> relation.
> reference more
> e-book, a
> them.
> description
>
> Maybe you could use inherited tables to achieve that.
>
> CREATE TABLE items (
> id SERIAL,
> description TEXT,
>
> PRIMARY KEY (id)
> )
>
> CREATE TABLE books (
> isbn VARCHAR(15),
> other_field INTEGER,
> ...
>
> ) INHERITS (items);
>
> CREATE TABLE cds (
> title VARCHAR(15),
> ...
>
> ) INHERITS (items);
>
> With this you can define the "general" attributes in the
> "items" table and more specific things in the specific tables.
>
> The primary key for all those tables will be kept unique
> across tables, since they will all refer to the same
> SEQUENCE.
>
> Maybe there are more elegant and correct solutions, I am
> just beginning my jorney to the PgSQL world (this, for
> example, couldn't be done with MySQL).
>
> --
> Ernesto Baschny <ernst(at)baschny(dot)de>
> http://www.baschny.de - PGP Key:
> http://www.baschny.de/pgp.txt
> Sao Paulo/Brasil - Stuttgart/Germany
> Ernst(at)IRCnet - ICQ# 2955403
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Aasmund Midttun Godal

aasmund(at)godal(dot)com - http://www.godal.com/
+47 40 45 20 46

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Markus Meyer 2001-10-23 17:06:12 Re: Database design?
Previous Message Tom Lane 2001-10-23 16:31:15 Re: oid not "UNIQUE" for use as FOREIGN KEY?