CREATE TABLE statement
468
For example, the following statement maps the table a1 to the MS Access
file
mydbfile.mdb
:
CREATE TABLE a1
AT ’access;d:\mydbfile.mdb;;a1’
$ For information on remote servers, see "CREATE SERVER statement"
on page 464. For information on proxy tables, see "CREATE EXISTING
TABLE statement" on page 441.
Foreign key definitions are ignored on remote tables. Foreign key definitions
on local tables that refer to remote tables are also ignored. Primary key
definitions are sent to the remote server if the server supports primary keys.
The COMPUTE clause is ignored for remote tables.
column-definition Define a column in the table. The following are part of
column definitions.
♦
column-name The column name is an identifier. Two columns in the
same table cannot have the same name. For more information, see
"Identifiers" on page 223.
♦
data-type For information on data types, see "SQL Data Types" on
page 263.
♦
NOT NULL If NOT NULL is specified, or if the column is in a
UNIQUE or PRIMARY KEY constraint, the column cannot contain
NULL in any row.
♦
DEFAULT For more information on the special-value, see "Special
values" on page 247.
If a DEFAULT value is specified, it is used as the value for the column
in any INSERT statement that does not specify a value for the column. If
no DEFAULT is specified, it is equivalent to DEFAULT NULL.
Some of the defaults require more description:
♦
AUTOINCREMENT When using AUTOINCREMENT, the
column must be one of the integer data types, or an exact numeric
type.
For performance reasons, it is highly recommended that DEFAULT
AUTOINCREMENT be used only with columns defined as a
PRIMARY KEY, with a UNIQUE constraint, or the first column of
an index. This allows the maximum value to be found at startup
time without scanning the entire table.