Skip to content

Information about the Sample Schema#

Script Files#

A schema creation file is provided at $ALTIBASE_HOME/sample/APRE/schema/schema.sql.

Executing this file creates the tables referenced in the manuals and populates them with sample data.

Therefore, if you would like to work with the examples described in the manuals, first execute the schema creation file, after which it will be possible to follow the provided examples.

The Sample Schema#

Purpose: Managing Customers and Orders

Tables: employees, departments, customers, orders, goods

employees Table#

Primary Key: Employee Number (eno)

Column Name Data Type Description Other
eno INTEGER Employee Number PRIMARY KEY
e_lastname CHAR(20) Employee Last Name NOT NULL
e_firstname CHAR(20) Employee First Name NOT NULL
emp_job VARCHAR(15) Title NULL allowed
emp_tel CHAR(15) Telephone Number NULL allowed
dno SMALLINT Department Number NULL allowed
INDEX ASC
salary NUMBER(10,2) Monthly Salary NULL allowed
DEFAULT 0
sex CHAR(1) Sex (Gender) NULL allowed
birth CHAR(6) Birthday NULL allowed
join_date DATE Date of entry NULL allowed
status CHAR(1) Status NULL allowed
DEFAULT 'H'

departments Table#

Primary Key: Department Number (dno)

Column Name Data Type Description Other
dno SMALLINT Department Number PRIMARY KEY
dname CHAR(30) Department Name NOT NULL
dep_location CHAR(15) Department Location NULL allowed
mgr_no INTEGER Administrator Number NULL allowed
INDEX ASC

customers Table#

Primary Key: Resident Registration Number (cno)

Column Name Data Type Description Other
cno CHAR(14) Customer Number PRIMARY KEY
c_lastname CHAR(20) Customer Last Name NOT NULL
c_firstname CHAR(20) Customer First Name NOT NULL
cus_job VARCHAR(20) Occupation NULL allowed
cus_tel NIBBLE(15) Telephone Number NOT NULL
sex CHAR(1) Sex (Gender) NOT NULL
birth CHAR(6) Birthday NULL allowed
postal_cd VARCHAR(9) Postal Code NULL allowed
address VARCHAR(60) Address NULL allowed

orders Table#

Primary Keys: Order Number & Order Date (ono, order_date)

Column Name Data Type Description Other
ono BIGINT Order Number PRIMARY KEY
order_date DATE Order Date PRIMARY KEY
eno INTEGER Sales Clerk NOT NULL
INDEX ASC
cno BIGINT Customer Number NOT NULL
INDEX DESC
gno CHAR(10) Product No. NOT NULL
INDEX ASC
qty INTEGER Order Quantity NULL allowed
DEFAULT 1
arrival_date DATE Expected Arrival Date NULL allowed
processing CHAR(1) Order Status NULL allowed
O: ORDER
R: PREPARE
D: DELIVERY
C: COMPLETE, DEFAULT 'O'

goods Table#

Primary Key: Product No. (gno)

Column Name Data Type Description Other
gno CHAR(10) Product Number PRIMARY KEY
gname CHAR(20) Product Name NOT NULL
UNIQUE
goods_location CHAR(9) Storage Location NULL allowed
stock INTEGER Stored Quantity NULL allowed
DEFAULT 0
price NUMERIC(10,2) Item Price NULL allowed

dual Table#

Record Size: 1

Column Name Data Type Description Other
DUMMY CHAR(1)