Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012

    Red face Unanswered: Small database design issue

    Hello there.

    I've done some database designing before, but I've run into a little problem that sorta makes my brain boil whenever I try to solve it.

    Basically, I'm making a system where people can select an ad for a site. This ad can be either a text link, or an image file they upload.

    My problem is that the image ad will have quite a few more properties associated with it, than the text type.

    So if we say that this is the main table:


    Obviously, in case of it being a text ad, I'd have imagePath, imageName and ImageExtension being empty, which will not do.

    I've tried thinking of having a reference to a table with the ad type, but that would still have to hold those image properties, which would result in empty space in case of a text ad.

    How do I separate those image fields to a place where they won't just be empty space when its a text ad?

    I'm sorry if the question is very simple, but I simply cant wrap my head around this.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    if you can't abide by the idea of null data then consider using the sub/supertype model
    OR if you 'know' this is the only variation dump the image related stuff into a table with a one to one relationship
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2012
    Well, its not that I can't abide by NULL data, but I was always under the impression that having NULL data in your table on a regular basis was a database sin.

  4. #4
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by Cruiser18 View Post
    ...having NULL data in your table on a regular basis was a database sin.
    urban myth | @rudydotca
    Buy my SitePoint book: Simply SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts