[thelist] Multi-level data storage
rudy
r937 at interlog.com
Tue Feb 27 16:21:37 CST 2001
> This is probably going to sound really dumb, but why are there two
> PRIMARY KEYs in the second table?
hi andrew
no such thing as a dumb question (okay, maybe "What's the number for 911?")
there's only one primary key in the second table, but it's a composite key,
consisting of two columns
thus
1 503
1 504
1 505
2 321
2 503
2 505
3 503
3 937
are all unique, even though taken individually, each column has duplicates
because it's a primary key, no set of any two numbers can be duplicated
> I would have thought that the LinkID would need to
> appear multiple times with each CatID that applied,
and so it can
there is an alternate way to do this, which is to create an auto_increment
primary key for this table, and then the above two columns can just be
carried along as data -- but this method is unnecessary if the database can
handle the first method (using a composite primary key)
helps?
rudy
More information about the thelist
mailing list