www.webdeveloper.com
Results 1 to 5 of 5

Thread: All in the one table OR not...

  1. #1
    Join Date
    Jul 2006
    Posts
    653

    All in the one table OR not...

    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...

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    The second one.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Jul 2006
    Posts
    653
    Thanks Charles...

  4. #4
    Join Date
    Oct 2007
    Posts
    126
    I would say it depends. if each member only has one row in the members table and they are likely to only have one row in the notifications table then I would just have one table that handles all of it. You aren't expanding your members table be many columns (10) so that wouldn't be a problem. Easier to script and maybe less round trips to the database when calling your values, unless of course you are great with joining multiple sql statements to pull values from different tables at the same time (I still find them a bit of a pain sometimes).

    If your notifications table is likely to have multiple rows per member then definitely go for the second option as Charles says. Also if your database is likely to grow with more and more values being added as you go along then again it maybe better to have a separate notifications table.

    Just my opinion. Hope I've not complicated things. :-)
    Last edited by cannon303; 06-12-2012 at 04:45 PM.

  5. #5
    Join Date
    Jul 2006
    Posts
    653
    Thanks Cannon303

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles