User's Manual
Chapter 7. SQL Remote Design for Adaptive Server Anywhere
Table Description
Customer All customers that do business with the company. The
Customer table includes the following columns:
♦ cust_key A primary key column containing an iden-
tifier for each customer
♦ name A column containing the name of each cus-
tomer
The SQL 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.
The Policy table has the following columns:
♦ policy_key A primary key column containing an
identifier for the sales relationship.
♦ cust_key A column containing an identifier for the
customer representative in a sales relationship.
♦ rep_key A column containing an identifier for the
sales representative in a sales relationship.
The SQL 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 )
);
Replication goals The goals of the replication design are to provide each sales representative
with the following information:
♦ The entire SalesRep table.
♦ Those rows from the Policy table that include sales relationships
involving the sales rep subscribed to the data.
113