Create an Access Table using SQL statements |
Author: Source: plwww Release Date: 2006.08.15 |
A long time ago, it took a day. There was no skill, but it was very practical. It was messy. Copy it to the notepad, remove the automatic line feed, and then it was organized :)
----------------------------------------------------------------------------
Type name type Remarks
----------------------------------------------------------------------------
Automatic number integer + identity (1, 1)
The number in the brackets of the text varchar (50) is the text length.
Long Integer
Integer short
Double, float
Single precision real
Byte
Fractional numeric (6, 2)
Currency Money
Note text
Date/time date, time, datetime
Yes/No bit
OLE object oleobject
----------------------------------------------------------------------------
Primary key
Required. Not null.
Default Value: default date ()
-----------------------------------------------------------------------------
Example
Description of Table Name field name type affiliated attributes
--------------------------------------------------------------------------------
Create Table mytable (m_id integer identity () primary key, -- auto-incrementing type, primary key
M_class varchar (50) not null default 'aaa', -- text, non-null, default value 'aaa'
M_int integer not null, -- long integer, non-null
M_numeric numeric (6, 2), -- decimal type
M_money money not null default 0.00, -- currency type, non-empty, default 0.00
M_memo text, -- Remark type
M_date date default date (), -- date type, default: current date
M_boolean bit default Yes, -- Boolean, yes by default
M_blob oleobject, -- blob type
M_double double, -- Double Type
M_float real) -- single precision type
Bytes ----------------------------------------------------------------------------------------------------------------------------
Create an index
Example 1
Create index myindex on mytable (m_class [DESC, ASC], m_int)
Example 2
Create unique index myindex on mytable (m_class) -- create a non-duplicate Index
Note: primary key fields are automatically created as non-duplicate indexes.
From, http://industry.ccidnet.com/art/1077/20051127/808651_1.html