Chapter 5. A Tutorial for Adaptive Server Enterprise Users

 

 

 

 

table to the SalesRep table. The relationship between the Customer table

 

and the SalesRep table is many-to-one.

The tables in the

The tables are described in more detail as follows:

database

 

 

 

 

 

 

Table

Description

 

 

 

 

 

 

 

 

SalesRep

One row for each sales representative that works 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)

 

 

)

 

 

 

 

Customer

One row for each customer that does business with the

 

 

company. The Customer table includes the following

 

 

columns:

 

 

 

 

 

cust_key

An identifier for each customer. This is the

 

 

primary key.

 

 

name

The name of each customer.

 

 

rep_key

An identifier for the sales representative in a

 

 

sales relationship. This is a foreign key to the SalesRep

 

 

table.

 

 

 

The SQL statement creating this table is as follows:

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 (rep_key

),

PRIMARY KEY (cust_key)

)

Replication goals

The goals of the replication design are to provide each sales representative with the following information:

55

Page 73
Image 73
Sybase DC38133-01-0902-01 manual Tutorial for Adaptive Server Enterprise Users, SalesRep table is many-to-one