iv
Specifying NUMERIC and DECIMAL with
Scale and Precision. . . . . . . . . . . . 4-8
Numeric Input and Exponents. . . . . . . 4-8
Specifying Data Types Using Embedded
Applications . . . . . . . . . . . . . . . . 4-8
Considering Migration for NUMERIC and
DECIMAL Data Types . . . . . . . . . . 4-9
Migrating Databases with NUMERIC and
DECIMAL Data Types . . . . . . . . . . 4-9
Using Exact Numeric Data Types in
Arithmetic . . . . . . . . . . . . . . . . .4-10
Floating-point Data Types . . . . . . . . . 4-11
Date and Time Data Types . . . . . . . . . . . .4-12
Converting to the DATE, TIME, and
TIMESTAMP Data Types. . . . . . . . . 4-13
How InterBase Stores Date Values . . . . 4-13
Character Data Types . . . . . . . . . . . . . . .4-14
Specifying a Character Set. . . . . . . . . 4-14
Characters vs. Bytes . . . . . . . . . . . .4-15
Using CHARACTER SET NONE . . . . .4-15
About Collation Order . . . . . . . . . . .4-15
Fixed-length Character Data . . . . . . . . 4-16
CHAR(n) or CHARACTER(n) . . . . . . . . .4-16
NCHAR(n) or NATIONAL CHAR(n). . . .4-16
Variable-length Character Data . . . . . . 4-16
VARCHAR(n) . . . . . . . . . . . . . . . .4-17
NCHAR VARYING(n). . . . . . . . . . . .4-17
The BOOLEAN Data Type . . . . . . . . . . . .4-17
Defining BLOB Data Types . . . . . . . . . . . .4-19
BLOB Columns. . . . . . . . . . . . . . . 4-19
BLOB Segment Length . . . . . . . . . . 4-20
Defining Segment Length . . . . . . . . .4-20
Segment Syntax. . . . . . . . . . . . . . .4-20
BLOB Subtypes . . . . . . . . . . . . . . 4-20
BLOB Filters . . . . . . . . . . . . . . . . 4-22
Using BLOBs with VARCHAR Data . . . . 4-22
About Text BLOB Syntax. . . . . . . . . .4-22
Defining Arrays. . . . . . . . . . . . . . . . . . .4-24
Multi-dimensional Arrays. . . . . . . . . . 4-25
Specifying Subscript Ranges for Array
Dimensions . . . . . . . . . . . . . . . . 4-25
Converting Data Types . . . . . . . . . . . . . .4-26
Implicit Type Conversions . . . . . . . . . 4-26
Explicit Type Conversions . . . . . . . . . 4-27
Chapter 5
Working with Domains
Creating Domains . . . . . . . . . . . . . . . . . 5-1
Specifying the Domain Data Type . . . . . .5-2
Specifying Domain Defaults . . . . . . . . . 5-3
Specifying NOT NULL . . . . . . . . . . . . 5-3
Specifying Domain CHECK Constraints . . . 5-4
Using the VALUE Keyword . . . . . . . . . 5-4
Specifying Domain Collation Order . . . . . 5-5
Altering Domains . . . . . . . . . . . . . . . . . . 5-6
Dropping a Domain . . . . . . . . . . . . . . . . . 5-7
Chapter 6
Working with Tables
Before Creating a Table . . . . . . . . . . . . . . 6-1
Creating Tables . . . . . . . . . . . . . . . . . . . 6-1
Defining Columns . . . . . . . . . . . . . . 6-2
Required Attributes . . . . . . . . . . . . . 6-2
Optional Attributes . . . . . . . . . . . . . . 6-2
Specifying the Data Type . . . . . . . . . . 6-3
Casting Data Types . . . . . . . . . . . . . 6-4
Defining a Character Set . . . . . . . . . . 6-4
The COLLATE Clause. . . . . . . . . . . . 6-4
Defining Domain-based Columns . . . . . 6-5
Defining Expression-based Columns . . . 6-5
Specifying Column Default Values. . . . . 6-6
Specifying NOT NULL. . . . . . . . . . . . 6-7
Defining Integrity Constraints . . . . . . . . 6-7
PRIMARY KEY and UNIQUE Constraints 6-7
Using the FOREIGN KEY to Enforce
Referential Integrity . . . . . . . . . . . . 6-8
Referencing Tables Owned by Others. . 6-10
Circular References . . . . . . . . . . . . 6-10
How to Declare Constraints. . . . . . . . 6-11
Defining a CHECK Constraint . . . . . . . 6-12
Using the EXTERNAL FILE Option . . . . 6-14
Restrictions . . . . . . . . . . . . . . . . . 6-15
Importing External Files . . . . . . . . . . 6-16
Exporting InterBase Tables to an External
File. . . . . . . . . . . . . . . . . . . . . 6-17
Altering Tables. . . . . . . . . . . . . . . . . . . 6-18
Before using ALTER TABLE. . . . . . . . 6-18
Saving Existing Data . . . . . . . . . . . 6-18
Dropping Columns. . . . . . . . . . . . . 6-19
Using ALTER TABLE . . . . . . . . . . . 6-20
Adding a New Column to a Table . . . . 6-20
Adding New Table Constraints . . . . . . 6-21
Dropping an Existing Column from a Table . .
6-21
Dropping Existing Constraints from a Column
6-22
Modifying Columns in a Table . . . . . . 6-22
Summary of ALTER TABLE Arguments. 6-24