SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2009
    Location
    Dublin
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New Database design

    Hi,

    I'm setting up a new database for our e-commerce site. I'm unsure on what the best approach would be on setting up billto and shipto address data for a customer and for an order. i'm thinking in some cases the customer address may differ in an order. Should the address data be in a separate table (addresses) so that the address_id will be associated with a customer and orders? I'm thinking this may be the best approach. Any thoughts will be appreciated.

    thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,250
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    no, don't bother

    the only reason you'd want to store addresses in and of themselves is if you cared about them as addresses, independent of whether any customer had those addresses

    for instance, the post office needs to know about an address regardless of who lives there

    if you're just tracking customers and orders, then address is a non-key attribute, and should be stored as data, not as a keyed relationship to another table

    the amount of duplication is likely miniscule anyway, so you won't even be saving space (and disk space is the cheapest thing you have to worry about)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Jun 2009
    Location
    Dublin
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, makes sense thanks for your help


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
  •