![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Good day- Let's say I have a shipment table (each record is a shipment). Each shipment will have an origin and a destination. The origin/destination can be any customer/vendor address pair (so, vendor to customer, customer to vendor, vendor to vendor). I have the customer and vendor address tables, and I was thinking that I need to have a pointer in my shipment table that points to a vendor/customer address record key. BUT, the problem is that, the customer/vendor address information can change, and a shipment needs to always have a reference to the exact address that was used when the shipment was set up (even if it's no longer the current/active address). So, is it proper/appropriate to just save the address information on each shipment record (not normalized)? Or, save an address pointer and make sure the software doesn't allow for deleting/ updating addresses. It seems like it'd be ok to save the actual address data on the shipment record. (I can't really decide, which is why I'm here ![]() Thanks for any comments folks, and I hope I was thorough in my explanation; if I'm lacking details, please just hollar. hoss |
#3
| |||
| |||
|
|
As to the theory, the shipping addresses (both from and to) are attributes of a shipment. If you consider that you most likely have many more shipments than addresses, though, it makes sense to store the addresses in a separate table to avoid duplication of data. However, it should be a "write-once-read-many-times" kind of table. |
|
Therefore, "address", "customer" and "vendor" are independent entities and should each have their own tables (IMHO) with appropriate relationships defined, i.e. you must have either a customer or a vendor in order to have an address. |
#4
| |||
| |||
|
|
the problem is that, the customer/vendor address information can change, and a shipment needs to always have a reference to the exact |
#5
| |||
| |||
|
|
In the book trade and others, ther are SANs (Standard Adddress Numbers), but you can build your own: CREATE TABLE SAN_History (san INTEGER NOT NULL, from_date DATE NOT NULL, to_date DATE, -- null means current name CHAR(35) NOT NULL, |
|
street1 CHAR(35) NOT NULL, street2 CHAR(35) NOT NULL, city state CHAR(2) NOT NULL CHECK (state IN (...)), zip_code CHAR(5) NOT NULL CHECK (zipcode SIMILAR TO '[0-9][0-9][0-9][0-9][0-9]'), ... PRIMARY KEY (san, from_date)); |
![]() |
| Thread Tools | |
| Display Modes | |
| |