0

I'm looking to create an order history for each client at work using MySQL.

I was wondering if it is best practice to create a separate table for each client, with each row identifying an order they've placed - or - to have one table with all orders, and have a column with an identifier for each client, which would be called to populate their order history.

We're looking at around 50-100 clients, with 10-20 orders a year that would be added to each of them so I am trying to make this as efficient as I am, performance wise.

Any help would be appreciated. Thanks.

4

1 回答 1

0

为特定数据(例如每个客户端)创建单独的表绝不是一个好主意,因为这会破坏 RDBMS 本身内的关系完整性/灵活性。您必须有一些外部的东西来添加/删除表,并且表之间不会具有完整性。

答案在您的第二句话中:一个订单表,其中有一列指向客户的唯一标识符。这是尽可能高效的,特别是对于如此小的数字。

于 2013-04-28T23:56:06.940 回答