views:

43

answers:

1

I'm planning a database for an enterprise cloud service. The service will be two web applications, one Warehouse management system and one for Invoices.

Companies can signup and become a "user" of the service, then they can have their Inventory and Invoice system online.

Should I keep all users/companies in the same table or should I have one table/application per user? It would be much easier to maintain if all users/companies use the same database table, but I think it would be easier to implement the serial number on invoices if I use one table per user/company.

The Inventory/Warehouse will contain up to 5,000 items per user/company.

Each Invoice are required to have a serial number, starting from 1 for the first invoice. So an Auto-Increment-column would be a good idea, if I have one table per user/company. Or how should I solve it if I put all companies in the same table and use a company_id-column?

How should I design the database for such an application? I will use MySQL as DBMS.

A: 

starting from 1 for the first invoice: that's probably not a good idea. Potential customers probably had a life before they join your service.

how should I solve it if I put all companies in the same table: just calculate the MAX of InvoiceId FOR THAT CUSTOMER, then increment it.

iDevlop