I have a single table with images which I need to link to 6 other tables. Let's say those tables are - Users, Tables, Foods, Restaurants, Categories, and Ships.
Should I create 6 different junction tables so each table has it's own junction table - Images_Users, Images_Tables, Images_Restaurants etc..?
Or is it better to create one table with a field to distinguish where it links - Images_Entity with fields- Id, Image_Id, Entity_Id, Entity_Type(I use this to distinguish whether its a user table, foods, or whatever). I don't like this solution since I will lack FK constraint in this case, but I'm leaning towards since the project will already have a large number of tables.
Perhaps there is a third approach? Create 6 image tables? Which solution is the best performance wise?
EDIT* Database will be used to display data, insert, update performance is not an issue, only select statements. I just figured out that no image can link to two entries(This makes the junction tables redundant).
Let me rephrase question entirely- What is the best way to connect Table with only one of the 6 other tables using a one to many association?
So Images table should contain FK and can link to only one of the 6 tables, never two at the same time.