Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 



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


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


<index_col_name> ::=

column_name [(length)] [ ASC | DESC ]

  • table_name: Specifies the name of a table to be modified.
  • index_name: Specifies the name of an index. If omitted, a name is automatically assigned.
  • index_col_name: Specifies the column that has an index to be defined. ASC or DESC can be specified for a column option; prefix_length of an index key also can be specified for a column option.

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

;schema a_tbl


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


 <Class Name>






     name                 CHARACTER VARYING(1073741823) DEFAULT ''

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

     age                  INTEGER

     id                   INTEGER AUTO_INCREMENT  NOT NULL




     UNIQUE u_a_tbl_id ON a_tbl (id)

     INDEX i1 ON a_tbl (age)

     INDEX i2 ON a_tbl (phone DESC)


Current transaction has been committed.