Quote:
Originally Posted by r937
let's take the second question first
there is only one PK, but it is a composite key, consisting of three columns
what that means is that the combinations of the three values are unique, even though a given value in any one of those three columns might occur multiple times
as for the FKs, each of them is a foreign key to its own separate table
|
Thank you.
In this DB theres going to be about 10 normalized tables with similiar PK/FK relationships. Thing is that I have to MYSQLIMPORT the data first.
So, is it best to set the PK-FK after I import the data?
Do you have a sample schema of how such a PK-FK relationship would look in a create/alter table?
Does this look like a good translation?
Quote:
CREATE TABLE SCREENS
(
screenid varchar(12),
headerid varchar(12),
bodyid varchar(12),
comment varchar(40),
primary key (screenid, headerid, bodyid),
FOREIGN KEY (screenid) REFERENCES screens(id),
FOREIGN KEY (headerid) REFERENCES headers(id),
FOREIGN KEY (bodyid) REFERENCES bodyid(id)
)
|