Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: primary key - tag numbers

Re: primary key - tag numbers

From: tretasdehr <tretasdehr_at_yahoo.co.uk>
Date: 3 Mar 2003 03:13:23 -0800
Message-ID: <cc15b354.0303030313.54a4fd8c@posting.google.com>


Thanks for your help guys.

71062.1056_at_compuserve.com (--CELKO--) wrote in message news:<c0d87ec0.0302240918.2397b4be_at_posting.google.com>...
> >> In a database of animals at a large shelter, the tag number of the
> animals can be large, but it will still need to be repeated after
> about 2 years. That is, the tag number will be used again. <<
>
> Make the tag number and the date the primary key, as you suggested,
> but keep the date separate. I assume that there will be a history of
> the tag number -- the animal is tagged, then (placed in a home, put
> down, sold to a circus, etc.) and the tag goes back into the box of
> tags in the kennel.
>
> CREATE TABLE History -- need better name!
> (tag_nbr INTEGER NOT NULL
> CHECK (tag BETWEEN 000000 AND 999999),
> event_code INTEGER NOT NULL
> REFERENCES Events(event_code)
> ON UPDATE CASCADE,
> event_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
> NOT NULL,
> ...,
> PRIMARY KEY (tag_nbr, event_date));
Received on Mon Mar 03 2003 - 05:13:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US