Previous |
Next
What is the SQL CREATE INDEX Statement?The SQL INDEX TABLE statement is the SQL command that adds a new index to an existing table to an SQL database. Indexed enable faster and more efficient retrieval of information from SQL databases. Why Use the SQL CREATE INDEX Statement?SQL indexes are used because they can provide the following benefits / functions:
Correct use of indexes can make the difference between a top performing database with high customer satisfaction and a non-performing database with low customer satisfaction. How To Use the SQL CREATE INDEX StatementThe SQL CREATE INDEX command is used as follows. SQL CREATE INDEX Statement Syntax
The number of characters that can make up SQL names for tables, columns and indexes varies by DBMS. In many cases the limit is 30 characters. The leading character of the name must be alphabetic - not a number or special character. The name of a new index can not duplicate the name of an existing index for the same table and should not be the same as a SQL reserved word. The underscore character can be used to improve readability. List elements are seperated by commas. SQL CREATE INDEX Statement Example 1 - Rapid Access The following example creates an non-unique index named IDX_PERSON_NAME on table PERSON with columns named person_name and gender_code in ascending sequence.. Here are the contents of the table:
This SQL CREATE VIEW Statement is executed:
SQL CREATE INDEX Statement Example 2 - Enforce Uniqueness The following example creates a unique index named IDX_PERSON_SSN on table PERSON with the column named social_security_nnbr. This assures that two rows can not be added to the PERSON table with the same social security number. This SQL CREATE TABLE Statement is executed:
|
SQL OVERVIEW
SQL BASICS
SQL SELECT
SQL WHERE
SQL INSERT
SQL UPDATE
SQL DELETE
SQL ADMINISTRATION
SQL CREATE DATABASE
SQL DROP DATABASE
SQL CREATE TABLE
SQL ALTER TABLE
SQL DROP TABLE
SQL CREATE INDEX
SQL DROP INDEX
SQL ADD FOREIGN KEY
SQL DROP FOREIGN KEY
SQL CREATE VIEW
SQL DROP VIEW
SQL ADVANCED
SQL CONCAT
SQL SUBSTRING
SQL TRIM
SQL AND & OR
SQL IN
SQL BETWEEN
SQL LIKE
SQL DISTINCT
SQL GROUP BY
SQL AGGREGATE
SQL HAVING
SQL ORDER BY
SQL JOIN
SQL OUTER JOIN
SQL SYNTAX
| HOME | SQL OVERVIEW | SQL BASICS | SQL ADMINISTRATION | SQL ADVANCED | SQL SYNTAX |
| Copyright© 1999-2006, First Place Software, Inc. |






