Displaying 1 result from an estimated 1 matches for "locations_people".
2006 Aug 02
2
many-to-one relationship, do I need a second table?
...REIGN KEY (location_id) REFERENCES locations(id),
PRIMARY KEY (id)
) TYPE=''InnoDB'';
And so, to describe my question, Im wondering if I need the secondary
relationship table (like a has_and_belong_to_many relationship) in order
to search for people by location.
CREATE TABLE `locations_people` (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
location_id INT UNSIGNED,
person_id INT UNSIGNED,
FOREIGN KEY (location_id) REFERENCES locations(id),
FOREIGN KEY (person_id) REFERENCES people(id),
PRIMARY KEY (id)
) TYPE=''InnoDB'';
--
Posted via http://www.ruby-forum.com/...