Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2008
    Posts
    53

    Unanswered: database for shop

    I would like to create database for shop. I have something like that:
    http://img341.imageshack.us/img341/9351/36237974.png

    Other tables aren't important at this moment because I have a question:
    If user can register and then he can change his name, surname, address, city, postcode etc. maybe I should also put these columns in table ORDER ?

    http://img7.imageshack.us/img7/6480/40116140.png

    What do you think ?

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I can't view images on that site due to certain restrictions, but - I'd say NOT. If you want to keep your database normalized, then keep those information in USER_INFORMATION table, not in several places.

    Though, perhaps images show a completely different design, can't tell.

  3. #3
    Join Date
    Dec 2008
    Posts
    53
    But what if user after registration and log in, order something and write address: Oxford Street 65, London, then he order something else and change his current address on: Green Street 12, New York - both orders will send to Green Street 12, New York. hm..... ??

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    It is up to you; will you allow such a scenario? If so, create a model that will support it.

    Someone may have more than a single address - in that case, create an ADDRESS table which will have a foreign key to USER_INFORMATION table and put all customer's addresses in there. Possibly with a DATE column so that you'd know which address is to be used with a certain order (because, orders do have a date, right? So valid address for that particular order is MAX date from ADDRESS table whose DATE column is less than order date).

  5. #5
    Join Date
    Dec 2008
    Posts
    53
    So as I understand You - user can add addresses but he can't modify them ? And then during order he can choose one of his adressess ?

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Yes and no; it depends on business requirements. You, as a developer, will do whatever is needed to fulfill those requirements.

    If business says "addresses can not be modified", you'll do that. If they say "addresses can be modified only if ...", then you'll do that. Etc. etc. I just tried to say how it *might* be, not how it *must* be.

  7. #7
    Join Date
    Aug 2009
    Posts
    262
    some times i have to order something for my sweetheart and many other sweethearts and surely they all donot live under the same roof and some times some new sweetheart i found makes another adress for the list.
    I wonder what would the shipping company do ?




    Table Customer: customer id (pk)
    Customer Name
    Bla Bla Bla
    more bla bla bla
    customer address
    credit card number with social security and cvv along
    with blank check and unlimited authorization

    Table ORDER : order id (pk)
    ----------------
    ----------------


    Table Shipment : Order id (fk)
    Customer id (fk)
    shipping address ( not null , either customer address
    or desired shipping address)
    process ( flag in process or shipped, p/s )

    so ( select * from shipping where process ='P' [ or ='S']

Posting Permissions

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