HP c-tree-SQL ISQL and Tools manual Define, Manage, Isql Create Table Custmast

Models: c-tree-SQL ISQL and Tools

1 99
Download 99 pages 4.83 Kb
Page 12
Image 12

ISQL and Tools

2.1.2Define

In this case define consists of the CREATE TABLE statement. This is done in a single iSQL statement in which specific fields are defined. Upon successful creation of the table, the changes made to the database by this transaction are made permanent by executing the COMMIT WORK statement. 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 CUSTMAST (

cm_custnum VARCHAR(5),

cm_custzip VARCHAR(10), cm_custstate VARCHAR(3), cm_custrating VARCHAR(2), cm_custname VARCHAR(48), cm_custaddrs VARCHAR(48), cm_custcity VARCHAR(48) );

ISQL> COMMIT WORK CUSTMAST;

2.1.3Manage

This step provides data management functionality for the applica- tion. We will simply add records to a table and then get and dis- play those records. Then a simple record deletion is performed and the records are displayed again. The following SQL state- ments provide the functionality to manipulate the records in our table.

INSERT INTO - This will add a record by inserting it into the table

SELECT - Fetch records according to select criteria

DELETE FROM - Delete records from a table.

COMMIT WORK - Make changes permanent.

Below is the interactive SQL for MANAGE:

Add Records

ISQL> INSERT INTO CUSTMAST

VALUES ('1000', '92867', 'CA', '1', 'Bryan Williams', '2999

Regency', 'Orange');

ISQL> INSERT INTO CUSTMAST

2-2

FairCom Corporation

Page 12
Image 12
HP c-tree-SQL ISQL and Tools manual Define, Manage, Isql Create Table Custmast, Isql Commit Work Custmast