首页 > 数据库 > 数据库开发技术 > Examples of Secondary Index

Examples of Secondary Index

原创 数据库开发技术 作者:tsinglee 时间:2007-11-22 17:24:34 0 删除 编辑


Create a secondary index called ITM_RELEASE_DATE on the RELEASE_DATE column in the ITEMS table:
CREATE INDEX itm_release_date ON items(release_date);

Primary key columns may also be included in a secondary index. If a table has the primary key
columns A, B, and C, the primary index would cover all three columns of the primary key.

The following combinations of the columns in the primary key are automatically indexed: A, AB, and
ABC. In addition, you could create secondary indexes on columns B, C, BC, AC etc.

An index may also be defined as UNIQUE, which means that the index value may only occur once in the
table. (For this purpose, NULL is treated as equal to NULL). However, it is preferable to use unique

Create a UNIQUE secondary index called ITM_EAN_CODE on the EAN_CODE column in the ITEMS table:
CREATE UNIQUE INDEX itm_ean_code ON ITEMS(ean_code);

Sorting Indexes
The sorting order for indexes may be defined as ascending or descending. However, this makes no
difference to the efficiency of the index, since Mimer SQL searches indexes forwards or backwards
depending on the circumstances.


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
  • 博文量
  • 访问量