Name

CREATE-INDEX — Create a database index.Function

Syntax

      create-index name &key on unique attributes database => 

Arguments and Values

name

The name of the index as a string, symbol or SQL expression.

on

The name of a table as a string, symbol or SQL expression.

unique

A Boolean.

attributes

A list of attribute names.

database

A database object which defaults to *default-database*.

Description

Creates an index called name on the table specified by on in database which default to *default-database*. The table attributes to use in constructing the index name are specified by attributes. The unique argument is NIL by default but if it has a non-NIL value then the indexed attributes must have unique values.

Examples

(create-index [bar] :on [employee] 
              :attributes '([first-name] [last-name] [email]) 
              :unique t)
=> 

(index-exists-p [bar])
=> T
      

Side Effects

An index is created in database.

Affected by

*default-database*

Exceptional Situations

An error is signalled if name is not a string, symbol or SQL expression. An error of type sql-database-data-error is signalled if a relation called name already exists.

See Also

drop-index
list-indexes
index-exists-p

Notes

None.