Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am working on a new MySQL database that will store orders/customer information for around 15 different services. 7 of the services are similar in regards to the information that is stored with a few of the 7 services requiring an additional piece of information. There other 7-8 services are similar to each other as well but not as similar the the first 7. So my question is how should I break this down into a MySQL database?

Should each service have its own table? If this is true, what is the best way to link tables? Any advice is greatly appreciated!

Also, here is a sample of the type of info that will be stored:

enter image description here

share|improve this question

migrated from stackoverflow.com Nov 29 '12 at 6:41

This question came from our site for professional and enthusiast programmers.

    
Make sure all of the addresses are in one table, not 3. Each service should not have its own table. You need to read up on Table Inheritance. Martin Fowler does it right. –  Neil McGuigan Jan 28 '13 at 19:12

2 Answers 2

good lord, no.

  1. read up on multi-tenancy http://msdn.microsoft.com/en-us/library/aa479086.aspx

  2. read up on the Party Model http://www.tdan.com/view-articles/5014/

  3. read up on Table Inheritance http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html

Then go read the data modeling books by Fowler, Silverston, or Hay.

share|improve this answer

One way to do it would be to have a primary table for orders that stores all of the common information. For the 7 or 8 other services with very different information, you could have tables such as Service_7_aux_orders_data (sorry, there's not enough information in the question to provide a better sample name) with a foreign key to your main orders table. When you query, you can join this table to the main order table to get the full order.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.