Sufendy
Sufendy

Reputation: 1242

2 tables with more than one relationship

I have 2 tables, an events and users. These 2 tables has 2 types of relationship.

1 event can have 1 creator (user) 1 user can create many events

and

1 event can have many members (users) 1 user can join many events

for the many-to-many relationship, I will create another table to link them. Probably named it participants.

But I'm not sure how should I put my first relationship (1-to-N above) into this. How should I design it?

Upvotes: 0

Views: 193

Answers (2)

VAShhh
VAShhh

Reputation: 3504

EVENTS should have a field named creator (foreign key of USERS)

USERS joins EVENTS in a M-N relation named PARTICIPANTS as you said.

Upvotes: 2

Peter Lang
Peter Lang

Reputation: 55524

The creator is not related to your participants, so I would not try to mix them.

Add the reference to the creator as another column to the event.

Upvotes: 2

Related Questions