RE: PK, SK, FK . . . ?

2001-02-06 Thread Quentin Bennett
Hi, Do you mean that the table has two unique indices, or that the primary index has two columns? Either way, it is easy to define this in mysql: create table foo ( col1 varchar(20) not null, col2 int not null, col3 smallint not null, primary key(col1, col2), unique second_idx(col1, col3));

RE: PK, SK, FK . . . ?

2001-02-06 Thread Cal Evans
It's ok for a table to have 2 keys that COULD be the PIKE. only 1 of them can actually BE the PIKE, the other is a Candidate Key. (CK) As to whether you should make them both part of the PK, that's a different question. I usually avoid compound PK's unless there is NO OTHER WAY AROUND IT. Cal