Jump to content
Larry Ullman's Book Forums

Separate User And Order Tables


Recommended Posts

What are the virtues of having the "User" table separate from the "Order" Table, rather than having all of it combined, aside from being able to insert the info bit by bit? I'm referring specifically to the second example.

Considering that customer info is repeated, is there really any need for a one-to-many relationship from the customer to orders table? Does it make that much difference to make them separate, or am I missing something?

Link to comment
Share on other sites

You are correct in that, since the site doesn't use a login system and the customer info will be repeated within the users table, that there's an argument for doing one table that represents the order and the user. But there's not currently a one-to-many relationship between customer and orders, there's a one-to-one relationship there (which is why they could be combined).

 

The argument for using separate tables is that you can add a user account/login system this way, with the same customer having one record in the users table and having multiple orders. My recommendation would be to support that. For example, I just made a purchase online at a site, and I went through the entire site and processed the order, then I was given the choice of creating an account (or not). The site did nothing to distract me from completing the order but still encouraged registration.

Link to comment
Share on other sites

 Share

×
×
  • Create New...