Answer the question
In order to leave comments, you need to log in
Is this table characterizing the many-to-many relationships correct?
Good day!
I am new to database design and in general, so do not blame me.
While working on the project, I noticed a table that was created for the Many-To-Many relationship. It looks like this:
items_categories:
id | item_type | item_id | category_id | delta
Actually, it stores links in itself: (products, product properties, groups (?) to categories). That is, the type of the item is stored in item_type. What is a delta, I still do not understand ...
So, is it normal to use such a table? If not, does such a table affect query speed?
Thanks
Answer the question
In order to leave comments, you need to log in
To link two tables on a many-to-many basis, a third table is indeed used. But it should contain only two fields - id1 and id2, since it is intended only to display the relationship between two entities, and nothing more. The rows in such a table do not need their own id, since you will not have two identical records.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question