SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Apr 2006
    Location
    London, United Kingdom
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Store in different tables or same table?

    I'm working on a new project and it will have several different user types. However, each different user type will require different information to be stored about each record in the database.

    Do I make individual tables for each user type or store them all in the same table anyway?
    eFlair Design | Premium Design Services and Web Consultation

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,323
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by emkay View Post
    Do I make individual tables for each user type or store them all in the same table anyway?
    yes to both!

    search for supertype/subtype and come back if you're still not sure ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot LinuxFreelancer's Avatar
    Join Date
    Jun 2011
    Location
    Boston, Ma, Usa
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It depends on how much data being stored differs based on their user type. I coded a social network that allows the choosing of a "account type" like facebook. So the profiles for the users is totally different based on their account type, so i created a table for each type. profile_bands, profile_personal, profile_business etc.

    The purpose is to keep the table as lite as possible and make it easy to setup INDEXes for faster queries.


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
  •