1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

I'm in database design HELL!

Discussion in 'BBS Hangout' started by what, Aug 2, 2015.

  1. heypartner

    heypartner Member

    Joined:
    Oct 27, 1999
    Messages:
    63,510
    Likes Received:
    59,002
    Yeah, not getting why anyone would complicate a customer acct table by making two of them.

    I also don't understand why OP is talking about a hierarchy, unless a single customer has multiple accounts. But that is still doable with a single table using a parent key.
     
  2. marky :)

    marky :) Member

    Joined:
    May 1, 2009
    Messages:
    4,563
    Likes Received:
    4,100
    This also ^;)
     
  3. EssTooKayTD

    EssTooKayTD Member

    Joined:
    Dec 15, 2005
    Messages:
    3,343
    Likes Received:
    74
    Surprised it took so many posts to arrive at this. Your entity is a customer, regardless of what type. A flag works, or if you like have a CustomerType set up to allow you to define other types of customers outside of individuals and companies in the future.
     
  4. ipaman

    ipaman Member

    Joined:
    Nov 23, 2002
    Messages:
    13,207
    Likes Received:
    8,046
    You're dealing with 3 things here, Customer, Companies, and People. You could take it even further by describing what each three things have, for example contact info like addresses and phone numbers. So Customer, Companies, People, and Addresses for example. With this data you could create Views that combine data from any or all of these tables. Customer for example could be a View of Companies, People, and Addresses. Views are fast, secure, and very flexible.
     
  5. dragician

    dragician Member

    Joined:
    Feb 27, 2011
    Messages:
    3,990
    Likes Received:
    131
    Sell insurance dude.
     
  6. what

    what Member

    Joined:
    Dec 4, 2003
    Messages:
    14,618
    Likes Received:
    2,584
    Im just trying to think through the problem. Think is my usual process to find the best dolution for me. My main thing really is kerping my update queries as simple as possible.
     
  7. heypartner

    heypartner Member

    Joined:
    Oct 27, 1999
    Messages:
    63,510
    Likes Received:
    59,002
    Response #2 said this. :cool:
     
  8. heypartner

    heypartner Member

    Joined:
    Oct 27, 1999
    Messages:
    63,510
    Likes Received:
    59,002
    And that is why you use one table for customer accounts. It doesn't matter if they are a person or a company; they should all have a customer id coming from the same table, or your JOINs to other info are waaaay too complicated. And further splitting account detail into separate tables based on person vs business is fine, but unnecessary.
     
  9. EssTooKayTD

    EssTooKayTD Member

    Joined:
    Dec 15, 2005
    Messages:
    3,343
    Likes Received:
    74
    So it did, haha. *thumbsup*
     

Share This Page