ALLBASE/SQL Reference Manual (36216-90216)

64 Chapter2
Using ALLBASE/SQL
Defining How Data is Stored and Retrieved
Defining How Data is Stored and Retrieved
To create database objects, you use data definition statements to define the following:
Tables
Views
Indexes
Constraints
Procedures
Rules
Creating a Table
When you define a table, use the CREATE TABLE statement to accomplish the following
tasks:
1. Establish an automatic locking mode and default access authorities.
2. Name the table.
3. Describe the columns.
4. Identify a DBEFileSet for storage of its rows.
The following example contains numbers that refer to the list of tasks shown above:
1 ---2---
| | |
CREATE PUBLIC TABLE PurchDB.Parts
(PartNumber CHAR(16) NOT NULL, ---
PartName VARCHAR(30), | --3
SalesPrice DECIMAL (10,2)) ---
IN WarehFS
|
4
You can also specify native language characteristics and integrity constraints at both the
table and the column level.
Choosing the Locking Mode and Default Access Authorities
ALLBASE/SQL uses one of four locking modes for controlling access to data in a table by
different transactions. A transaction is one or more SQL statements that together perform
a unit of work. The locking modes are as follows:
PRIVATE mode allows only one transaction at a time to access a table for reading or
updating. Locking is done at the table level. PRIVATE is the default mode.
PUBLICREAD mode allows multiple transactions to read a table, but only one to update
it. Locking is done at the table level.