Chapter 7. SQL Remote Design for Adaptive Server Anywhere

Partitioning tables that do not contain the subscription expression

In many cases, the rows of a table need to be partitioned even when the subscription expression does not exist in the table.

The Contact example

The Contact database illustrates why and how to partition tables that do not contain the subscription expression.

Example

Here is a simple database that illustrates the problem.

 

 

 

 

 

 

Contact

 

 

 

 

 

 

 

contact_key

char(10)

 

 

name

char(40)

 

 

cust_key

char(12)

 

 

 

 

 

 

 

 

 

 

 

cust_key = cust_key

Customer

cust_key char(12)

namechar(40)

rep_key char(5)

rep_key =

rep_key

SalesRep

rep_key char(5)

name char(40)

Each sales representative sells to several customers. At some customers there is a single contact, while other customers have several contacts.

The tables in the

The three tables are described in more detail as follows:

database

 

 

 

Table

Description

 

 

 

 

SalesRep

All sales representatives that work for the company. The

 

 

SalesRep table has the following columns:

 

 

rep_key An identifier for each sales representative.

 

 

This is the primary key.

 

 

name The name of each sales representative.

 

 

The SQL statement creating this table is as follows:

 

 

CREATE TABLE SalesRep (

 

 

Rep_key CHAR(12) NOT NULL,

 

 

Name CHAR(40) NOT NULL,

 

 

PRIMARY KEY (rep_key)

 

 

)

 

 

 

105

Page 123
Image 123
Sybase DC38133-01-0902-01 manual Contact example, Here is a simple database that illustrates the problem