HP c-tree-SQL ISQL and Tools manual Quick Tour

Models: c-tree-SQL ISQL and Tools

1 99
Download 99 pages 4.83 Kb
Page 15
Image 15

Quick Tour

OrderList - A table of records consisting of a list of orders.

OrderItem - A table of records consisting of specific items associated with an order.

ItemMaster - A table of records consisting of information about items.

CustomerMaster - A table of records consisting of specific info related to each customer.

Each order (ordernum) in the orderlist table will contain 1 or more items (itemnum) in the orderitem table. Each item will have a corresponding definition (weight, price, description) in the itemmast table. An order is related to a specific customer (custnum) in the custmast table which contains information about each customer.

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_ordernum VARCHAR(7), ol_custnum VARCHAR(4));

ISQL> CREATE INDEX custorder ON orderlist (ol_ordernum, ol_custnum);

ISQL> CREATE TABLE orderitems ( oi_ordernum VARCHAR(7), oi_seqnumber SMALLINT, oi_quantity SMALLINT, oi_itemnum VARCHAR(6));

ISQL> CREATE INDEX orderitem ON orderitems (oi_ordernum, oi_seqnumber);

ISQL> CREATE TABLE itemmast ( im_weight INTEGER, im_price MONEY, im_itemnum VARCHAR(6),

im_desc VARCHAR(48));

FairCom Corporation

2-5

Page 15
Image 15
HP c-tree-SQL ISQL and Tools manual Quick Tour