1

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?

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.