开发者

Multiple arrays of the same data type in a SQL database

If I am keeping a collection of people in a SQL database, and each person has a separate collection of objects of the same data type, what is the best way to store the objects and keep them linked to their owners? It seems like multiple tables would be more efficient when reading only one person's objects, but since there are a variable and unlimited number of people obviously there cannot be a table for each person's objects.

Is the usual strategy to create one table for all the people's objects and include an index with each object to identify the object's owner, or is 开发者_开发知识库there a better way to store and link the data?


One table for people and one table for objects. Store the person ID with each object and then to get the objects for a person simply query the objects table against their person ID.


Multiple arrays of the same data type in a SQL database

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜