SQL Remote User's Guide
A Tutorial for Adaptive Server Enterprise Users
Introduction
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.
The database schema for the tutorial is illustrated in the figure.
Features to note include the following:
Each sales representative is represented by one row in the SalesRep table.
Each customer is represented by one row in the customer table.
Each customer is assigned to a single Sales representative, and this assignment is built in to the database as a foreign key from the Customer table to the SalesRep table. The relationship between the Customer table and the SalesRep table is many-to-one.
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:
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:
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) ) |