Chapter 7. SQL Remote Design for AdaptiveSer verAnywhere
Table Description
Customer All customers that do business with the company. The
Customertable includes the following columns:
cust_key Aprimary key column containing an iden-
tifierfor each customer
name A column containing the name of each cus-
tomer
TheSQL statement creating this table is as follows:
CREATE TABLE Customer (
Cust_key CHAR(12) NOT NULL,
Name CHAR(40) NOT NULL,
PRIMARY KEY (cust_key)
);
Policy A three-column table that maintains the many-to-many
relationship between customers and sales representatives.
ThePolicy table has the following columns:
policy_key A primary key column containing an
identifierfor the sales relationship.
cust_key A column containing an identifier for the
customerrepresentative in a sales relationship.
rep_key A column containing an identifier for the
salesrepresentative in a sales relationship.
TheSQL statement creating this table is as follows.
CREATE TABLE Policy (
policy_key CHAR(12) NOT NULL,
cust_key CHAR(12) NOT NULL,
rep_key CHAR(12) NOT NULL,
FOREIGN KEY ( cust_key )
REFERENCES Customer ( cust_key )
FOREIGN KEY ( rep_key )
REFERENCES SalesRep (rep_key ),
PRIMARY KEY ( policy_key )
);
Replicationgoals Thegoals of the replication design are to provide each sales representative
withthe following information:
Theentire SalesRep table.Thoserows from the Policy table that include sales relationshipsinvolvingthe sales rep subscribed to the data.113