ADD INDEX Clause

Description

You can define the index attributes for a specific column by using the ADD INDEX clause.  

Syntax

ALTER [ TABLE | CLASS ] table_name ADD { KEY | INDEX } [index_name] (<index_col_name>)

 

<index_col_name> ::=

column_name [(length)] [ ASC | DESC ]

Example

ALTER TABLE a_tbl ADD INDEX (age ASC), ADD INDEX(phone DESC);

;schema a_tbl

 

=== <Help: Schema of a Class> ===

 

 <Class Name>

 

     a_tbl

 

<Attributes>

 

     name                 CHARACTER VARYING(1073741823) DEFAULT ''

     phone                CHARACTER VARYING(13) DEFAULT '111-1111'

     age                  INTEGER

     id                   INTEGER AUTO_INCREMENT  NOT NULL

 

 <Constraints>

 

     UNIQUE u_a_tbl_id ON a_tbl (id)

     INDEX i_a_tbl_age ON a_tbl (age)

     INDEX i_a_tbl_phone_d ON a_tbl (phone DESC)

 

Current transaction has been committed.