Reputation: 503
A have list of items created by users, this items can be reordered by them. Efficient data structure for this described here.
But in my case users can share their items between each other and reorder them as well. So it means that we need to store elements order for each user. What is a best database structure for this? I can see only one way: create duplicate item and store reference to the origin item, but it look odd for me.
Upvotes: 0
Views: 248
Reputation: 1270191
You want an association/junction table. This would have at least three columns:
(And you might have additional columns, such as an auto-incremented primary key and a creation dat.)
The first two should be foreign references to a users
and items
table respectively.
Upvotes: 4