All in the one table OR not...

Discussion in 'PHP' started by oo7ml, Jun 12, 2012.

  1. #1
    Hi, i am developing a site at the moment and i need to work on the Notification Settings for my members.

    I have 'members' table in my database that contains info such as:

    - id
    - first name
    - last name
    - gender
    - dob
    - location
    - email
    etc...

    I have on average 10 different notification and email settings that each user can customise, such as:

    [ ] email me when i am sent a new private message

    Should i expand the 'members' table and add the 10 notification settings or should i create a separate 'notifications' table that will hold all of the notification settings and link it to the 'members' table with a foreign key, thanks in advance for you help...
     
    oo7ml, Jun 12, 2012 IP
  2. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #2
    Complying with the standards of a relational database model you would create a separate Table to hold all the notification information. Especially if there will be more than a few columns.

    In all of my projects I use a separate Table. Then a JOIN statement when fetching the data. It's easy and keeps things neat.
     
    NetStar, Jun 12, 2012 IP
  3. SpiderxXx

    SpiderxXx Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    007ml:
    you should definitely create a separate table for the notifications. Everything will be easier later if you would like to do any changed on it:)regards
     
    SpiderxXx, Jun 12, 2012 IP
  4. dez1974

    dez1974 Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    use a separate table! agree 100% -
     
    dez1974, Jun 12, 2012 IP
  5. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #5
    Thanks all... appreciate your feedback ;)
     
    oo7ml, Jun 12, 2012 IP