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


 
Quick Tour
FairCom Corporation 2-7
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;
The following SQL statement performs the query and displays a very small report. This query
uses a join of 3 tables to list quantity and price for each item of an order. A basic introduction
to the report generation capabilities provided by the iSQL Utility is shown in the form of the
Column, Format and Heading syntax.
COLUMN cm_name FORMAT "A15" heading "NAME"
COLUMN oi_quantity FORMAT "A10" heading "QTY"
COLUMN im_price FORMAT "$A10" heading "PRICE"
SELECT custmast.cm_name, orderitems.oi_quantity, itemmast.im_price
FROM custmast, orderitems, itemmast, orderlist
WHERE orderlist.ol_custnum = custmast.cm_custnum AND
orderlist.ol_ordernum = orderitems.oi_ordernum AND
orderitems.oi_itemnum = itemmast.im_itemnum
ORDER BY orderlist.ol_custnum;
The report will appear as follows:
Name QTY PRICE
---- --- -----
Michael Jordan 2 $19.95
Michael Jordan 1 $9.99
Michael Jordan 1 $16.59
Joshua Brown 3 $16.59
2.2.4 Done
When a client application has completed operations with the
server, it must release resources by disconnecting from the data-
base. iSQL is an application that provides an interface for inter-
active SQL. It may not be explicit but a connection is made with
the server when the isql tool is launched. Likewise, a disconnect
occurs when the isql tool is exited.
Below is the interactive SQL for DONE:
ISQL> quit
This will return the process back to a regular command line prompt.