Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with indexes

Using clustered indexes Next Page

Creating indexes

Indexes are created on one or more columns of a specified table. You can create indexes on base tables or temporary tables, but you cannot create an index on a view. To create an individual index, you can use either Sybase Central or Interactive SQL. You can use the Index Consultant to guide you in a proper selection of indexes for your database.

When creating indexes, the order in which you specify the columns becomes the order in which the columns appear in the index. Duplicate references to column names in the index definition is not allowed.

To create a new index for a given table (Sybase Central)
  1. Connect to the database as the DBA.

  2. Open the Tables folder and select the table for which you want to create an index.

  3. In the right pane, click the Indexes tab.

  4. From the File menu, choose New > Index.

    The Create Index wizard appears.

  5. Follow the instructions in the wizard.

    The new index appears on the Index tab for the table. It also appears in the Indexes folder.

To create a new index for a given table (SQL)
  1. Connect to the database as a DBA user or as the owner of the table on you are creating the index.

  2. Execute a CREATE INDEX statement.

  3. In addition to creating indexes on one or more columns in a table, you can create indexes on a built-in function using a computed column. For more information, see CREATE INDEX statement.


    The following example creates an index called EmployeeNames on the Employees table, using the Surname and GivenName columns:

    CREATE INDEX EmployeeNames
    ON Employees (Surname, GivenName);

    For more information, see CREATE INDEX statement, and Monitoring and Improving Performance.