0

I'm new to MySQL, I've created my first data driven website but have some questions about how to best structure it for multiple users.

To explain: The website allows companies to keep track of promotions they are offering. Many companies will use the website and from each company there will be many promotions and many users. The database will contain several table describing the products being offered, sales data etc.

Assuming they successfully login,I assume it's best for each company's info to be stored in separate databases, I see three options for how to structure the data:

  1. Should I also have a distinct database for each promotion?(This will lead to a very large number of databases).
  2. Would it be better to only have a single database with data from all promotions appended within the same tables and distinguished the records with a column describing the promotion id? (This strikes me as the simplest conceptually, however, with this approach the tables would become large, and when the user sorts the tables they will have to sort data from all promotions even though they are only interested in a single promotion)
  3. Or should I have a single database and create separate tables for each promotion, perhaps by adding the promotion name as a suffix.(This will lead to a very large number of tables within the database over time as each company may have 100 promotions a year).

Sorry for the long question, any help appreciated.

Thanks

Easynow
  • 191
  • 1
  • 3
  • 14
  • @Easynow — You have two completely different questions here. That doesn't work well with Stackoverflow's Q&A model. You should edit the second question out and ask it separately (actually, you shouldn't, since I'd be amazed if there aren't lots of duplicates for it that you could find by searching). – Quentin Sep 03 '16 at 09:54
  • @Quentin You're right, I misread that. The database password should be stored safely on the server side, accessible only from authenticated code. – Tim Biegeleisen Sep 03 '16 at 09:55

0 Answers0