Chapter 8. SQL Remote Design forAdaptive Ser verEnter prise
Table Description
Contact All individualcontacts that do business with the company.
Each contact belongs to a single customer. The Contact
tableincludes the following columns:
contact_key An identifier for each contact. This is
theprimary key.
name Thename of each contact.
cust_key Anidentifier for the customer to which the
contact belongs. This is a foreign key to the Customer
table.
TheSQL statement creating this table is:
CREATE TABLE Contact (
contact_key CHAR(12) NOT NULL,
name CHAR(40) NOT NULL,
cust_key CHAR(12) NOT NULL,
FOREIGN KEY (cust_key)
REFERENCES Customer,
PRIMARY KEY (contact_key)
)
go
Replicationgoals Thegoals of the design are to provide each sales representative with the
followinginformation:
Thecomplete SalesRep table.
Thosecustomers assigned to them, from the Customer table.
Thosecontacts belonging to the relevant customers, from the Contact
table.
Maintenanceof proper information when Sales Representative territories
arerealigned.
Territory realignment in the Contact example
Interritory realignment, rows are reassigned among subscribers. Inthe
currentexample, territory realignment involves reassigning customers
amongthe sales representatives. Itis carried out by updating the rep_key
columnof the Customertable.
TheUPDATE is replicated as an INSERT or a DELETE to the old and new
salesrepresentatives, respectively, so that the customer row is properly
transferredto the new sales representative.
151