ALLBASE/SQL Reference Manual (36216-90216)

Chapter 2 81
Using ALLBASE/SQL
Manipulating Data
Manipulating Data
Most users of ALLBASE/SQL are primarily interested in manipulating data in
DBEnvironments. Data manipulation consists of following operations:
Selecting data
Inserting data into tables
Updating rows in tables
Deleting rows
In order to select data, you create queries, which are fully described in the next chapter.
The other types of data manipulation are presented briefly in the next sections. For
complete information, refer to the descriptions of the SELECT, INSERT, UPDATE, and
DELETE statements in the “SQL Statements” chapter.
Inserting Data
You use the INSERT statement to add rows to a table, specifying the following information:
1. A table or view name
2. Column names
3. Column values
The following example contains numbers that refer to the items in the list above:
1
|
INSERT INTO PurchDB.Parts
(PartNumber, PartName) --2
VALUES ('9999-AJ','Interface Engine')
| |
----------------------------
|
3
Only a single table name or view name can be specified. Only certain views can be used to
insert rows into a base table, as described under “Updatability of Queries” in Chapter 3 ,
“SQL Queries.
The column names can be omitted if you are going to put a value into every column in the
row. Otherwise, you name the columns you want to assign values to, enclosing the column
names in parentheses and separating multiple column names with commas. Columns not
named are assigned their default values. If no default exists for a column, it is assigned the
null value. If you define a column as NOT NULL when you create a table, then you
must
assign a non-null value or specify a default value to the column.
The column values are also enclosed in parentheses and separated by commas. Character
data is delimited with single quotation marks. The value NULL can be entered into columns
that permit null values.