ISQL and Tools

im_desc VARCHAR(48));

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));

COMMIT WORK;

DELETE FROM orderlist;

DELETE FROM orderitems;

DELETE FROM itemmast;

DELETE FROM custmast;

COMMIT WORK;

INSERT INTO itemmast VALUES (10, 19.95, '1', 'Hammer'); INSERT INTO itemmast VALUES (3, 9.99, '2', 'Wrench'); INSERT INTO itemmast VALUES (4, 16.59, '3', 'Saw'); INSERT INTO itemmast VALUES (1, 3.98, '4', 'Pliers');

INSERT INTO custmast VALUES ('1000', '92867', 'CA', '1', 'Bryan Williams', '2999 Regency', 'Orange');

INSERT INTO custmast VALUES ('1001', '61434', 'CT', '1', 'Michael Jordan', '13 Main', 'Harford');

INSERT INTO custmast VALUES ('1002', '73677', 'GA', '1', 'Joshua Brown', '4356 Cambridge', 'Atlanta');

INSERT INTO custmast VALUES ('1003', '10034', 'MO', '1', 'Keyon Dooling', '19771 Park Avenue', 'Columbia');

COMMIT WORK;

INSERT INTO orderitems VALUES ('1', 1, 2, '1'); INSERT INTO orderitems VALUES ('1', 2, 1, '2');

INSERT INTO orderlist VALUES ('9/1/2002', '9/5/2002', '1', '1001'); SELECT orderitems.oi_itemnum, itemmast.im_itemnum

FROM orderitems, itemmast

WHERE orderitems.oi_itemnum = itemmast.im_itemnum; SELECT orderlist.ol_custnum, custmast.cm_custnum

FROM orderlist, custmast

WHERE orderlist.ol_custnum = custmast.cm_custnum;

COMMIT WORK;

INSERT INTO orderitems VALUES ('2', 1, 1, '3'); INSERT INTO orderitems VALUES ('2', 2, 3, '4');

INSERT INTO orderlist VALUES ('9/2/2002', '9/6/2002', '2', '9999'); SELECT orderitems.oi_itemnum, itemmast.im_itemnum

FROM orderitems, itemmast

WHERE orderitems.oi_itemnum = itemmast.im_itemnum; SELECT orderlist.ol_custnum, custmast.cm_custnum

FROM orderlist, custmast

WHERE orderlist.ol_custnum = custmast.cm_custnum;

A-4

FairCom Corporation

Page 94
Image 94
HP c-tree-SQL ISQL and Tools manual Imdesc VARCHAR48