Examples of data-definition queries (MDB)

Microsoft Office Access 2003

This data-definition query uses the CREATE TABLE statement to create a table named Friends. The statement includes the name and data type for each field in the table and assigns the FriendID field an index that marks it as the primary key.

CREATE TABLE Friends
([FriendID] integer,
[LastName] text,
[FirstName] text,
[Birthdate] date,
[Phone] text,
[Notes] memo,
CONSTRAINT [Index1] PRIMARY KEY ([FriendID]));

ShowCreating an index

This data-definition query uses the CREATE INDEX statement to create a multiple-field index on the LastName and FirstName fields of a table called Friends.

CREATE INDEX NewIndex 
ON Friends ([LastName], [FirstName]);