When does using multiple tables make sense?
| From: | Jason Pruim | Date: | Mon, 20 Oct 2008 11:59:36 +0000 |
| Subject: | When does using multiple tables make sense? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-45539@lists.php.net to get a copy of this message | ||
Good morning everyone!
Hope you all have your coffee in hand when reading this :)
In case it makes a difference, It will be written in PHP 5.2.6 and using mysql 5.0.51a-community with apache 2.2.9.
I am in the planning stages of a project that will turn into a customer relation management system. I know there are quiet a few out there, but I may need to be able to tie it into some accounting software that we use here so I need to write my own... Besides, I get paid to do it :)
Now... the meat of the question... When does it make sense to use multiple tables? I am going to have the name/contact info for the business, codes for when we contacted them last and how (Phone, e-mail, postal mail, etc. etc), I also want to track the history of changes made to each record.
Right now, I am thinking 3 tables, 1 with the name, address, phone, etc. on it. a second with the contact codes, and a date. And the third for keeping track of the changes.
I started thinking about it though... and I could have at least 6 tables, Address/contact info. Contact codes. Changes. Customer History. Sales Rep Info. Access Control...
Right now the organization is small, only 9 full time employees including production, so it's not a huge deal, but I'm hoping this will be something that will help grow the company and we will have sales people all over the world :)
So my question is... When is it best to use more tables? All the info will be related to each other, so I think I would be looking at either a many-to-many relationship, or a many-to-one relationship (still figuring that out).
I am also considering writing it as a module system so that I can just plug things in as needed, I could also then get it up and running faster I think..
Was anyone able to determine what I am really asking in this long mess of words? :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@raoset.com