Contents Index Goals Replication goals

SQL Remote User's Guide
  A Tutorial for Adaptive Server Enterprise Users
    Introduction

The database


The tutorial uses a simple two-table database. One table holds information about sales representatives, and the other about customers. The tables are much simpler than you would use in a real database; this allows us to focus just on those issues important for replication.

Database schema 

The database schema for the tutorial is illustrated in the figure.

Features to note include the following:

The tables in the database 

The tables are described in more detail as follows:

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)
)

Contents Index Goals Replication goals