HP (Hewlett-Packard) c-tree-SQL ISQL and Tool reference Guide Printer User Manual


 
ISQL and Tools
2-14 FairCom Corporation
Transaction
These tables consist of a Customer Master table and an Item Master table that support prima-
rily static information regarding a company's product line and customer demographics. The
orderlist and orderitems tables consist of dynamic information pertinent to day to day sales.
This dynamic data makes its way into the database as a transaction. If any part of the data is
invalid then the transaction is rolled back and none of the data will enter the database. In this
tutorial a transaction is comprised of the order and the items that make up an order.
The following SQL syntax provides the functionality for the define phase:
CREATE TABLE - Create a table.
COMMIT WORK - Make changes permanent.
Below is the interactive SQL for DEFINE:
ISQL> CREATE TABLE orderlist (
ol_orderdate DATE,
ol_promdate DATE,
ol_ordnum VARCHAR(7),
ol_custnum VARCHAR(4));
ISQL> CREATE TABLE orderitems (
oi_ordernum VARCHAR(7),
oi_seqnumber SMALLINT,
oi_quantity SMALLINT,
oi_itemnum VARCHAR(6));
ISQL> CREATE TABLE itemmast (
im_weight INTEGER,
im_price MONEY,
im_itemnum VARCHAR(6),
im_desc VARCHAR(48));
ISQL> CREATE TABLE custmast (
cm_custnum VARCHAR(5),
cm_zip VARCHAR(10),
cm_state VARCHAR(3),
cm_rating VARCHAR(2),
cm_name VARCHAR(48),
cm_address VARCHAR(48),
cm_city VARCHAR(48));
ISQL> COMMIT WORK;