D
D
Div-Man2018-08-12 19:23:16
Database design
Div-Man, 2018-08-12 19:23:16

Which attitude to choose?

Let's say you can put an article in different categories, then is it better to make a separate table for this and use a many-to-many relationship?
Or do one-to-many without a pivot table?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2018-08-12
@0xD34F

you can put an article in different categories <...> one to many

Have you tried to imagine it? If one to many, and an article can belong to different categories, then the category itself can contain only one article. That is, it is not a category at all. So many to many, no options.

K
Konstantin B., 2018-08-12
@Kostik_1993

Depending on how you want, if there is one category for one post, then you don’t need it, but if there is one post for several, then you need it through the pivot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question