SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: How to store multiple values of one attribute?

  1. #1
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to store multiple values of one attribute?

    I have a Users table which stores various characteristics about the users. For example basic stuff like age, sex, location, etc. These ofcourse hold single values which are easy to store. But I also have attributes that need to hold multiple choice values. It doesn't seem like good database design to store multiple comma separated values into one field. But it also seems counterintuitive to store the atributes with multiple choice values in a separate table. So what would be the correct solution?

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,456
    Mentioned
    34 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Botch View Post
    It doesn't seem like good database design to store multiple comma separated values into one field.
    it isn't

    Quote Originally Posted by Botch View Post
    But it also seems counterintuitive to store the atributes with multiple choice values in a separate table.
    i guess this depends on who is doing the intuiting

    this is actually the correct solution
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! Guess I have to re-arrange some stuff hehe

Bookmarks

Posting Permissions

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