SQL getting started Tutorial: SQL CREATE INDEX syntax

Source: Internet
Author: User

SQL getting started Tutorial: SQL CREATE INDEX syntax

The table used to create the index in the create index statement.

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


Metrics
This index can be created in a table to find data faster and more effective.

Users cannot see indicators. They are only used to speed up search/query.

Note: It takes more time to update Tables and indexes than to update a table (because indicators still need to be updated ). Therefore, you should create only index columns (tables) and search them frequently.
SQL syntax for creating Indexes
Create an index table. Repeated values are allowed:

Create index index_name
ON table_name (column_name)

SQL CREATE UNIQUE INDEX syntax creates a UNIQUE INDEX seat. Duplicate values are not allowed: create unique index index_name
ON table_name (column_name) SQL create index instance. The SQL statement is as follows: CREATE an INDEX named "PIndex". The "last name" column is in the "p" table: create index PIndex
ON Persons (LastName) If you want to CREATE an indexed column, you can list the column names in brackets separated by commas (,): create index PIndex
ON Persons (LastName, FirstName)

Related Article

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.