Re: Assign Foreign key
- From: "Jamie Collins" <jamiecollins@xxxxxxxxxx>
- Date: 5 Mar 2007 01:07:31 -0800
On Mar 4, 11:31 am, "Allen Browne" <AllenBro...@xxxxxxxxxxxxxx> wrote:
ReadingsTbl should have its own primary key field - typically an autonumber.
The symbol field cannot be primary key in this table, since it can occur
many times.
I think the most likely candidate is a compound (no pun intended) key
of (symbol, Readdate). A key should prevent duplicate data; just
adding an autonumber would allow duplicates to be created e.g.
INSERT INTO ReadingsTbl (symbol, Read1) VALUES ('FE'. 1.1)
;
INSERT INTO ReadingsTbl (symbol, Read1) VALUES ('FE'. 1.1)
;
INSERT INTO ReadingsTbl (symbol, Read1) VALUES ('FE'. 1.1)
;
etc
In summary, a foreign key is ... a field in one table
that links to the primary key of another table
No, the OP has the point: *generally* it is the 'primary key' however
RI can be enforced using any 'unique' constraint (a.k.a. key).
a one-to-one relation, which is rare.
Not at all. The classic example is human relationships where in
marriage it is polygamy (one to many) that is the rare case and
monogamy (one to one) that by far the most common across cultures.
Jamie.
--
.
- References:
- Re: Assign Foreign key
- From: Allen Browne
- Re: Assign Foreign key
- Prev by Date: Re: Assign Foreign key
- Next by Date: Re: What should I set for Primary Key
- Previous by thread: Re: Assign Foreign key
- Next by thread: What should I set for Primary Key
- Index(es):
Relevant Pages
|