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

Page 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

Image 15
Contents For use with c-treeSQL Server Isql and Tools Reference GuidePage Table of Contents Data Load Utility dbload Iii Tutorial Source CodeFairCom Corporation Audience Syntax Diagram ConventionsDocumentation Overview Purpose of this ManualIsql and Tools Related DocumentationOverview IntroductionIsql and Tools FairCom Corporation Isql Quick TourIntroductory Tutorial InitIsql Commit Work Custmast DefineManage Isql Create Table CustmastDone Complete Introductory Tutorial CodeQuick Tour ISQLTutorial2.sql Relational Model and Indexing TutorialQuick Tour Insert Into Values Insert IntoValues QTY Price Commit WorkComplete Relational Model and Indexing Tutorial Source Code ISQLTutorial3.sql Locking Tutorial@ISQL @iSQLTutorial3.sql Isql Delete from Custmast Complete Locking Tutorial Source Code ISQLTutorial4.sql Transaction Processing TutorialTransaction Rollback Work Complete Transaction Processing Tutorial Source Code Arguments Isql StatementsStarting Interactive SQL SyntaxConnectstring PasswordStatement History Support UsernameStatement Summary Formatting Output of Isql QueriesIsql Statements Isql Statements for Statement History SupportDisplay Isql Statements for Query Formatting SummaryCustomername Customercity Orderid Ordervalue Example 3-1 Unformatted Query Display from IsqlExample 3-2 Controlling Display Width of Character Columns Formatting Column Display with the Column StatementExample 3-3 Customizing Format of Numeric Column Displays OrdervalueCustomername Customercity Example 3-4 Specifying Column Breaks and Values with Display Numorders Customername Example 3-6 Specifying a Query Header and Footer with Title Transaction Support Help and Table StatementsExample Isql Reference1 @ Execute Syntax DescriptionBreakspec Break SyntaxExamples Skip nCustomername History Clear SyntaxBreak Column Compute Display Title ArgumentColumn Syntax OptionColumnname Format formatstringHeading headingtext Character Description Date-Time Format Strings for the Column StatementNull ? Type Length Colname Not Null INTChar Orderinfo AmountSysdate Compute FLDColumn Title NEW TitleVariablename AVG MAX MIN SUM CountValue Define Syntax@columnname ColpositionDisplayvalue COL columnnumberEdit Syntax Exit or Quit Syntax Related StatementsExit Isql GET query.sql 10 GET SyntaxIsql RUN Orderstate Lotlocation Help CommandsclausesHelp Syntax History SyntaxFollowing example illustrates usage of the History statement Hostcommand Host or SH or SyntaxFrom List Syntax Isql History Quit or Exit Syntax16 RUN Syntax QuitLinesize Save Syntax18 SET Syntax PagesizePagesize numberlines TBL Connection databasename DefaultTransaction Isolation Level isolationlevel Isql Break on Isql Select TBL from Systables TBLShow Syntax Database Connections Is Default ?Spool Syntax Filename onIsql Spool OFF Start SyntaxArgument … Isql Spool STK onNot Null Varchar Null ? Type Length Colname Not Null INTTablename Type Length Colname Null ?Date Double Title SyntaxLeft Center Right COL n TextIsql Clear Title Isql and Tools FairCom Corporation Introduction Data Load Utility dbloadOptions Dbload Command Line SyntaxCommandsfile Prerequisites for DbloadData Load Utility dbload Data File FormatsNext Record Commands FileVariable Length Records Fixed Length RecordsChar Short Long Float Double Define Record StatementNull For Each StatementExamples Example 4-1 Sample dbload commands filesCompilation Errors Record name redefinedPosition not specified for fixed length record Fatal Errors Isql and Tools FairCom Corporation Prerequisites for Dbdump Data Unload Utility dbdumpDbdump Command Line Syntax Short Long Float Double Data Unload Utility dbdumpFor Record Statement Define Record custrec of Fixed Length 37 AS Isql and Tools FairCom Corporation Schema Export Utility dbschema Username.triggername Username.procedurenameOutfile Username.tablenameEND Schema Export Utility dbschemaDbschema Import BeginIsql and Tools FairCom Corporation Commit Work Select * from Custmast Delete from Custmast Tutorial Source CodeInteger MoneyVARCHAR6 Commit Work Delete from Custmast Tutorial Source CodeImdesc VARCHAR48 Select * from orderlist Select * from orderitems Isql and Tools FairCom Corporation Index-i SymbolsIndex-ii FairCom Corporation IsqlIndex-iii FairCom Corporation Index