A Sample Database with Sample Data

 

The structure of the Salespeople table

COLUMN

CONTENT

snum

A unique number assigned to each salesperson as an employee number. This is the primary key of the table. (Column attribute type: INTEGER)

sname

The last name of the salesperson. (Column attribute type: CHAR(15) )

city

The location of the salesperson. This indicates one of a set of company offices.

(Column attribute type: CHAR(15) )

comm

The salesperson's commission on orders in decimal form. (Column attribute type: NUMERIC(3,2) )

The Salespeople table

snum

sname

city

comm

1001

Peel

London

0.12

1002

Serres

San Jose

0.13

1004

Motika

London

0.11

1007

Rifkin

Barcelona

0.15

1003

Axelrod

New York

0.10

 

 

The structure of the Customers table  

COLUMN

CONTENT

cnum

 

A unique number assigned to each customer. This is the primary key of the table.

(Column attribute type: INTEGER)

cname

The last name of the customer. (Column attribute type: CHAR(15) )

city

 

The location of the customer. This actually indicates a company office, rather than the city where the customer resides. (Column attribute type: CHAR(15) )

rating

 

A numeric code indicating the level of preference assigned to this customer. Higher numbers indicate greater preference. NULL indicates a customer who has not yet been assigned a rating. (Column attribute type: INTEGER)

 

snum

 

The number of the salesperson assigned to this customer. This is a foreign key referencing Salespeople (snum). Since we don't want a customer to languish if his assigned salesperson is not available, we have enabled a mechanism for other salespeople to handle this customer when the one normally assigned is not available. We explain this mechanism below. (Column attribute type: INTEGER)

 

The columns of the Customers table  

cnum

cname

city

rating

snum

2001

Hoffman

London

100

1001

2002

Giovanni

Rome

200

1003

2003

Liu

San Jose

200

1002

2004

Grass

Berlin

300

1002

2006

Clemens

London

NULL

1001

2008

Cisneros

San Jose

300

1007

2007

Pereira

Rome

100

1004

 

 

The structure of the Orders table

COLUMN

CONTENT

onum

A unique number given to each purchase. This is the primary key of the table.

(Column attribute type: INTEGER)

amt

The amount of the purchase. (Column attribute type: NUMERIC(8,2) )

odate

The date of the purchase. (Column attribute type: DATE )

 

cnum

The number of the customer making the purchase. This is foreign key referencing Customers (cnum). (Column attribute type: INTEGER)

snum

The number of the salesperson credited with the sale. This is a foreign key referencing Salespeople (snum). It normally would be the salesperson assigned to the customer in the Customers table, but may not be, as explained in the beginning of the document. (Column attribute type: INTEGER)

 

The Orders table

onum

amt

odate

cnum

snum

3001

18.69

10/03/2000

2008

1007

3003

767.19

10/03/2000

2001

1001

3002

1900.10

10/03/2000

2007

1004

3005

5160.45

10/03/2000

2003

1002

3006

1098.16

10/03/2000

2008

1007

3009

1713.23

10/04/2000

2002

1003

3007

75.75

10/04/2000

2004

1002

3008

4723.00

10/05/2000

2006

1001

3000

1309.95

10/06/2000

2004

1002

3011

9891.88

10/06/2000

2006

1001