S
S
Sergey Khlopov2019-04-19 13:10:17
Database design
Sergey Khlopov, 2019-04-19 13:10:17

How to correctly form links between a table with a photo and with regions?

Hello, please tell me the best way to do this. I have a table in the "regions" database, in which various information about the regions is stored there, it is necessary that these regions have photos, there can be many photos for each region. Actually what is the best way to make a connection? Many-to-many? Will there be an intermediate table in the end where the id of the region and the id of the photos will be compared?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Shumov, 2019-04-19
@Shlop

If you have a single table with all the images in the project, then many-to-many is a separate table.
If you have a separate table with images for regions, then enter the region_id field in it and link it. (it is important to understand that it is unlikely that you use one photo for several regions)

I
irishmann, 2019-04-19
@irishmann

many to one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question