Access Data Table field type and creation example

Source: Internet
Author: User

-----------------------------------------------------------------

Type name type Remarks

-----------------------------------------------------------------

Text char (n) Where n represents the field size

Text varchar (N)

Text text

Number [byte] Byte

Number [integer] short

Number [long integer] Long, integer

Number [single precision] single, real

Number [Double Precision] Double, float

Number [automatic number] integer identity)

Number [automatic number] counter

Binary

Currency, money

Remarks memo

Date/time date, time, datetime

Yes/No bit

OLE object oleobject

-----------------------------------------------------

Primary key

Required. Not null.

Default Value: default date ()

-----------------------------------------------------

 

When using the create table statement, use the following fields to define the type:

Boolean, integer, long, currency, single, double, date, string, and variant (default)

 

-----------------------------------------------------

 

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_money money not null default 0.00, // -- currency type, non-null, 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.

 

Modify attributes

Alter table admin alter column username varchar (200)

 

Add Column

Alter table admin add userpass varchar (50) null

 

Delete column

Alter table admin drop column userpass

 

This content is organized from http://www.940194.cn/ShowData/2008-10/74.html

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.