mysql - How to add more than one value to a database table row? -
i have 2 tables named event , activity. have eventid foreign key of activity table , activityid fk of event table. problem is, activity can have 1 event, event can have many activities. can add 1 value activityid column in event table. can please suggest me solution it?
you need junction table . . . eventactivities, this:
create table eventactivities ( eventactivitiesid int not null primary key auto_increment, eventid int not null references events(eventid), activityid int not null references activities(activityid) ); then database have 3 tables, , don't need column directly connecting activities , events.
Comments
Post a Comment