mysql - Are these too many foreign keys? -


i'm using mysql , have been planning out database structure system i'm building out. i've been going along, started wonder if acceptable have particular foreign key constraint in many different tables. understand, fine, makes sense. i'd double check.

for example, have users table, , use user_id foreign key many tables, multiple times in 1 table. example, have one-to-one relationship user_settings table, of course stores user_id. , have companies table, alone has few references user_id key. in case, have column keeps track of user created company in system (created_by), column main contact (main_contact, user of system), , there might reference. alone, has user_id key being used foreign key constraint 3-4 times.

just add bit of info, have tasks table , of course needs reference user_id keep track of it's assigned to, , have column keeps track of user created task. assigned_to , created_by, respectively.

there more tables though reference key. might 8 references already. believe i've designed far, based on i've mentioned, sound fine?

your foreign key usage seems fine me - after all, representing logical relationships between tables.

a user within system interacts data in many ways, , define these relationships approach correct one.

the key point think under lot circumstances, won't want (or need) make joins represent relationships - ones need in context.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -