Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    16

    Unanswered: Tables desgin help.

    I am currently doing a project where I collect different data for different websites, data that comes from different domains will be different and unique to each domain name.

    Should I go for a design like this:

    PHP Code:
    domain_data
    id    domain    data_description    data

    data_descriptions
    id    description 
    Or should I have a separate table for each domain.

    PHP Code:
    website_1
    id    w1_data_1    w1_data_2 etc

    website_2
    id    w2_data_3    w2_data_4 etc 
    Thanks for any help

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i'm surprised you even thought about asking

    the second scheme is horrible
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2010
    Posts
    16
    Yeh it is I agree.

    But I wasnt sure that using a description column to describe the data was the right way to go, because you could then put any type of data in the same table.

    Wouldent that break the rules of normalization?

  4. #4
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    Quote Originally Posted by nzo View Post
    Yeh it is I agree.

    But I wasnt sure that using a description column to describe the data was the right way to go, because you could then put any type of data in the same table.

    Wouldent that break the rules of normalization?
    The point of normalization is to describe data in such a way that you can manipulate it with SQL. A description column or a comments column tends to defeat that: you can't manipulate English text with SQL.

    But if all you want to say is, "the English description of this domain is 'description'," and all you'll ever want to do is read it or set it, that's (at least) in 1NF. It's a judgment call you have to make.

    Incidentally, you'd probably want to just one description for each domain. So it ought to be a column of domain_data rather than split off in its own table.

Posting Permissions

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