Imagine that we have an e-shop. We need to store images connected with products somewhere on server. We already know, that it is better to store images in filesystem and keep the reference in DB.
The question is what is the best way to interconnect images in filesystem with product in DB:
I am thinking about:
keep the reference to unique folder dynamically created for this product in DB (f.e. directly in products table)
create new table in db (something like product_and_images) where we will keep information about product identification and image identification and table will serve for all products
Thanks for all of your answers and sorry for my terrible english :)
It is always better to maintain separate table and use foreign key reference