Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

Recommended Posts

I have an images table that has 5 foreign keys that reference 5 other tables, each of those tables uses the images table to store images, when an image gets uploaded, the foreign key in question gets a value associated with it in the images table but the other 4 foreign keys will get NULL values in that row. Is that acceptable, or should I rethink my database design? What would be the best way to go?

 

 

Share this post


Link to post
Share on other sites

You should rethink your design. Lots of NULL values is generally bad, and you should never have FK columns that are NULL. 

Share this post


Link to post
Share on other sites

Are you actually storing images is a table or are you storing image URLs?

 

If you are storing images (as blob data) it might be appropriate to ask here about the wisdom of this. From what I've researched it is not advisable as it is too taxing on the performance of the dB.

 

So, if you are redesigning anyway, try keeping the images in your file system and reference by URL.

 

This is as much a question as a suggestion because I know there may be reasons "backing up?" for keeping images in a table.

OR

It could be that my information is simply outdated by now.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...