SQL Remote User's Guide
SQL Remote Design for Adaptive Server Enterprise
Partitioning tables that do not contain the subscription column
The Contact database illustrates why and how to partition tables that do not contain the subscription column.
Here is a simple database that illustrates the problem. We call this database the Contact database, because it contains a Contact table in addition to the two tables described earlier in this chapter.
Each sales representative sells to several customers. At some customers there is a single contact, while other customers have several contacts.
The three tables are described in more detail as follows:
Table | Description |
---|---|
SalesRep |
All sales representatives that work for the company. The SalesRep table has the following columns:
CREATE TABLE SalesRep ( rep_key CHAR(12) NOT NULL, name CHAR(40) NOT NULL, PRIMARY KEY (rep_key) ) go |
Customer |
All customers that do business with the company. The Customer table includes the following columns:
CREATE TABLE Customer ( cust_key CHAR(12) NOT NULL, name CHAR(40) NOT NULL, rep_key CHAR(12) NOT NULL, FOREIGN KEY ( rep_key ) REFERENCES SalesRep, PRIMARY KEY (cust_key) ) go |
Contact |
All individual contacts that do business with the company. Each contact belongs to a single customer. The Contact table includes the following columns:
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 |
The goals of the design are to provide each sales representative with the following information:
The complete SalesRep table.
Those customers assigned to them, from the Customer table.
Those contacts belonging to the relevant customers, from the Contact table.
Maintenance of proper information when Sales Representative territories are realigned.