carlwenrich Posted March 18, 2007 Posted March 18, 2007 Can anyone tell me why there are entry_firstname and an entry_lastname columns in the address_book table when the customers table already has customers_firstname and customers_lastname columns?
Nullachtfuffzehn Posted March 18, 2007 Posted March 18, 2007 The address book is used to enter shipping addresses different from the customers one, so it makes sense, doesn't it?
carlwenrich Posted March 18, 2007 Author Posted March 18, 2007 I don't know. I would think that every shipping address was some customer's shipping address. I'm still new to this, but I read that one of the goals of database design was to minimize the replication of data. Personally, I would have put mailing address and shipping address information directly into the customer record, rather than having a separate address book table and replicated fields in order records. But as I say, I'm new to this (still learning) so there may be other issues (database access speed, etc.) that also need to be considered.
Nullachtfuffzehn Posted March 18, 2007 Posted March 18, 2007 Any shop I know has the possibility to enter shipping addresses different ro the customers address. Imagine you live in Chile in the Atacama desert and want to send your GF in Alaska a birthday present as well as one for your mother in Norway for her wedding day. In addition you want to order yourself a new towel because of the heat down there. Can you see what the address book is for? Otherwise you'd always have to alter your accout data, which would overwrite the existing data. And your GF in Alaska has another birthday next year... Ok, so far... Minimizing the replication of data is a goal for sure, but in this case the data are nor replicated, but different. To get a better understanding, try to get some information about the entity-relationship-model. It describes how the data are interacting and what to store where. For example, if a customer orders a product, the customers adress, the shipping address, the products data and much more are stored in the orders table (and related). Replicated data? Sure, but they belong to the order. The customers address may change, shipping addresses may change, also the products data. But the order is an entity and all the data are it's properties. If you wouldn't store them with the order and look into it later on, you may see something completely different than the original order was. That makes sense. The towel you've ordered has the part_id #15 and it was the last one in stock. Shortly after you made the order, the shop owner decided to reorganize the shop and made product # 15 razor blades. In the meantime the shipping department is packing your order and, wonder, they send you some razor blades instead of a towel. Bad luck, isn't it. So you can see, that it sometimes make sense to store the data in multiple locations.
carlwenrich Posted March 18, 2007 Author Posted March 18, 2007 It makes a lot more sense now. Thanks for taking the time to explain it.
Nullachtfuffzehn Posted March 18, 2007 Posted March 18, 2007 You're welcome. It's luck, that it's sunday afternoon and I'm a bit bored. During the week I wouldn't have the time to write such explanations.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.