Accuracer: The First And Only BDE Alternative
Client-Server Single-File Embedded Database for Delphi / C++Builder / Kylix



CREATE INDEX Statement

Previous  Top  Next


Introduction

The CREATE INDEX statement is used to create new index in a table.

Syntax

CREATE [UNIQUE] INDEX [IF NOT EXISTS] index_name ON table_name
(
field_name [ASC | DESC] [CASE | NOCASE]
[,field_name...]
)

Use CREATE INDEX to create index in a table. Indexes are used to increase search and sorting speed. Indexes decrease performance of inserting, updating and deleting data.

The UNIQUE option specifies restriction on inserting rows to a table with duplicate columns values. It means that all rows in a table have unique combination of index columns values.

The IF NOT EXISTS option specifies that index should be created only if it does not exists in this table.

The ASC option specifies ascending order, the DESC option specifies descending order. The default value is ASC.
The CASE option specifies case-sensitive index, the NOCASE specifies case-insensitive index. The default value is CASE.

Examples:

CREATE UNIQUE INDEX Text_Index ON Test
(
Text DESC NOCASE,
ID
)

CREATE UNIQUE INDEX Text_Index ON MEMORY [Test MEMORY TABLE]
(
[My Text] DESC NOCASE,
ID
)


Note:
Table, column and index names can be specified in square brackets ([]). Thus you can use reserved words (like TABLE) and special symbols (like ' ') in table, column and index names.



© AidAim Software Accuracer: Client-server Database Single-file Database Delphi Database Embedded Databas