1

I have created three tables called person, metadata_image and person_image.

person table contains info about people.
person_id
person_name
person_bio

metadata_image table stores the images.
image_id
image_url
image_type
image_size
date_uploaded
importance (if importance equals to 1, I use that image as cover picture)

person_image has foreign keys from person and image tables.
person_id
metadata_image_id

Additional image :

enter image description here

Should I add a third column like person_image ID as a unique and auto increment value or is my structure okay as it is?

1

With just the two foreign keys in there I would leave it as it is.

If other tables have a foreign key pointing to person_image then the debate becomes a lot more nuanced and you will start considering table size and query (plan) complexity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.