edpatterson
IS-IT--Management
- Feb 24, 2005
- 186
I tried searching on unique and found lots of good information, but nothing I could adopt to my needs.
What I have
Tables:
Sites
siteID int(11) not null, auto_increment
name varchar(30) not null
Rooms
roomID int(11) not null, auto_increment
name varchar(20) not null,
siteID not null,
primary key (roomID)
foreign key (siteID) references sites (sitesID)
Obviously there will be multible room 100's in the table, I want to make sure that there is only one site X room 100.
Is is possible to use foreign columns in a key/index?
Thanks,
Ed
What I have
Tables:
Sites
siteID int(11) not null, auto_increment
name varchar(30) not null
Rooms
roomID int(11) not null, auto_increment
name varchar(20) not null,
siteID not null,
primary key (roomID)
foreign key (siteID) references sites (sitesID)
Obviously there will be multible room 100's in the table, I want to make sure that there is only one site X room 100.
Is is possible to use foreign columns in a key/index?
Thanks,
Ed