John Salerno wrote: > Carsten Haese wrote: > > >>> [id] [university] [yearStart] [yearEnd] [degreeEarned] > >>> 1 U of I 1971 1975 BS > >>> 1 U of I 1975 1976 MS > >>> 1 U of I 1976 1977 PhD > >>> > >> Thanks guys. I do plan to have an id entry for each person as well, I > >> just forgot to mention that. But since it's a primary key, I didn't know > >> I could list it more than once. Or does primary key not necessarily mean > >> unique? > > > > Primary key *does* mean unique in the table that defines it. However, if > > you take a primary key ID from one table and store it in a different > > table, that's a foreign key. There are no inherent uniqueness > > constraints on a foreign key. > > > > So in the example above, isn't that using the same primary key multiple > times in the same table?
Actually, the [id] in the example was intended to be the foreign key, I didn't specify an id for the degree records themselves. A more typical example would be [Eid] [Sid] [university] [yearStart] [yearEnd] [degreeEarned] 5 1 U of I 1971 1975 BS 6 1 U of I 1975 1976 MS 7 1 U of I 1976 1977 PhD where [Eid] is the primary key of the Education table and [Sid] is the foreign key from the Student table so that the single student record (1) links to three education records (5,6,7). -- http://mail.python.org/mailman/listinfo/python-list