SQLMemTable: Embedded BDE Alternative
In-Memory SQL Database for Delphi / C++Builder



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.

Here is an example:

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



© AidAim Software SQLMemTable: In-memory Sql Database Delph