Hi all, I am having a little trouble deciding how to relate some of my
tables together.

 

I was wondering about creating one big lookup table to relate 3 or 4
tables together, but wasn't sure if that was a good id, or should I have
a look up table

For each pair of tables.

 

Here is a simple example of my tables.

 

Orgs:  org_id   org_name  (org_id is primary key)

 

Contacts:  con_id, con_name, org_id (con_id is primary, org_id is
foreign key)

 

Events:   ev_id, ev_name, org_id, con_id (ev_id is primary, con_id and
org_id are foreign keys)

 

This is centered around organizations, so every contact must belong to
an org, likewise for an event.  I will create an org called None in case
they just want

To track the occasional lone contact or internal event.

 

But because an organization can have many contacts and many events, I
was thinking of using lookup tables.

 

I.e., Contacts are assigned to Organizations,

So have a table called assigned with org_id and con_id as a composite
primary key. And each is a foreign key back to the correct table...

 

And should I have a table that links orgs and events and contacts and
events, or should I have one lookup table

That relates them all together, i.e. orgs contacts, and events..?

 

To simplify, is It better to have many smaller lookup tables or one big
one?

 

Thanks,

Taylor

Reply via email to