HP c-tree-SQL ISQL and Tools manual Quick Tour, Introductory Tutorial, Init, Isql

Page 11

Chapter 2

Quick Tour

2.1INTRODUCTORY TUTORIAL

iSQL_Tutorial1.sql

This introductory tutorial will rapidly take you through the basic use of the powerful interactive SQL (iSQL) database interface. iSQL is a full featured command line client side query tool useful for submitting ad hoc SQL statements to a Server. Likewise the tool provides ample output formatting capabilities.

By no means does this introduction cover the full scope, detail, or

flexibility that iSQL offers. It does however provide a quick glimpse of the benefits a tool such as this provides in a development environment.

This tutorial operates on the assumption that the database named 'myDatabase', already exists. Please refer to Section 3.6 “Introduction to the c-treeSQL ISQL Utility” in c-tree Plus Quick Start and Product Overview Guide for details on how to set up the environment for the tutorial.

This example, like all others in this set of documentation, will take the creation and use of a database and fit it into a simple four step flow of initialization, definition, management, and completion. (Init, define, manage, and you're done!)

Now let's break into the four areas.

2.1.1Init

The initialize step is as simple as launching the iSQL tool. The syntax for this is as follows:

isql [-u user_name] [-a password] [connect_string]

At the command line prompt type:

isql -u ADMIN -a ADMIN myDatabase

iSQL responds with the following prompt:

ISQL>

At this point, any valid SQL statement terminated with a semi-colon may be submitted.

FairCom Corporation

2-1

Image 11
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 CustmastQuick Tour DoneComplete Introductory Tutorial Code ISQLTutorial2.sql Relational Model and Indexing TutorialQuick Tour Values Insert IntoValues Insert Into 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 StatementCustomername Customercity Example 3-3 Customizing Format of Numeric Column DisplaysOrdervalue 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 SyntaxCustomername ExamplesSkip n History Clear SyntaxBreak Column Compute Display Title ArgumentColumn Syntax OptionHeading headingtext ColumnnameFormat formatstring Character Description Date-Time Format Strings for the Column StatementChar Null ? Type Length ColnameNot Null INT Sysdate OrderinfoAmount Compute FLDColumn Title NEW TitleVariablename AVG MAX MIN SUM CountValue Define Syntax@columnname ColpositionDisplayvalue COL columnnumberEdit Syntax Exit Exit or Quit SyntaxRelated Statements Isql GET query.sql 10 GET SyntaxIsql RUN Orderstate Lotlocation Help CommandsclausesHelp Syntax History SyntaxFollowing example illustrates usage of the History statement From HostcommandHost or SH or Syntax 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 INTDate TablenameType Length Colname Null ? 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 filesPosition not specified for fixed length record Compilation ErrorsRecord name redefined 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 CodeVARCHAR6 IntegerMoney 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