foreign keys - MySql Shared lookup table -


i've got 2 'event' type tables, both of can have list of 'users' involved event. i'd use common lookup table users, i'm not sure how setup fks.

highlight: |id   |details|  event: |id   |details|  contacts: |event_id  |highlight_id  |user  |type | 

this doesn't work, event_id and/or highlight_id null depending on event type i'm dealing with.

i'd avoid lookup table each event if possible

i'd use separate lookup tables user_event , user_highlight. unless there reason create user_id|event_id|highlight_id relation (row), makes little sense define way.

events +-----+ event_id detail  highlights +---------+ highlight_id detail  users +----+ user_id  user_event +---------+ user_id  (fk) event_id (fk)  user_highlight +-------------+ user_id       (fk) highlight_id  (fk) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -