List:General Discussion« Previous MessageNext Message »
From:Marc Guay Date:July 21 2010 5:44pm
Subject:Table which can reference a number of other tables
View as plain text  
Hi everyone,

I have a question regarding database design, I hope that this is
appropriate for the list.  Let's say that I have the following tables:

clients (id,name)
contacts (id, name, phone, client_id (FK))

companies (id, name)
employees (id, name, phone, company_id (FK))

logins (id, username, password)


What's the best way to connect contacts and employees to the logins
table?  I've thought of duplicating the username & password fields
into both the contacts and employees tables, adding both contact_id
and employee_id foreign keys to the logins table, and adding login_id
foreign keys to the contacts and employees tables, but none of these
solutions seem very smart.

Thanks,
Marc
Thread
Table which can reference a number of other tablesMarc Guay21 Jul
  • Re: Table which can reference a number of other tablesMySQL)22 Jul
Re: Table which can reference a number of other tablesNguyen Manh Cuong21 Jul
  • RESET MASTER doesn't workJoe Hammerman12 Aug
Re: Table which can reference a number of other tablesMarc Guay26 Jul
  • Re: Table which can reference a number of other tablesGeert-Jan Brits26 Jul