SQL Getting Started Tutorial: SQL CREATE INDEX syntax

Source: Internet
Author: User
Tags create index

SQL Getting Started Tutorial: SQL CREATE INDEX syntax

The table in which the index statement is created to create the metric.

Metrics allow database applications to find data quickly, without reading the entire table.


Index
The index can be built in a table to find data more quickly and efficiently.

Users cannot see metrics, they are only used to speed up search/query.

Note: Table updates and indexes require more time than updating a table (because the metrics also need to be updated). So you should only create indicator columns (tables) that will be frequently on the search.
SQL syntax for creating indexes
Creates a table for an index. Duplicate values are allowed:

CREATE INDEX index_name
On table_name (COLUMN_NAME)

The SQL create unique index syntax creates a unique index for seating. Duplicate values are not allowed: CREATE UNIQUE INDEX index_name
On table_name (COLUMN_NAME) SQL CREATE index instance bar. The following SQL statement creates an index named "Pindex" on the column "P" table: Create INDEX Pindex
On Persons (LastName) If you want to create an exponential combination of columns, you can list the column names in parentheses, separated by commas: Create INDEX Pindex
On Persons (LastName, FirstName)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.