MySQL Advanced Learning-index

Source: Internet
Author: User
Tags create index

1: Index

An index is a special kind of file that contains reference pointers to all the records in the data table. It is a structure that sorts the values of one or more columns in a database table.

Simple to understand:

A database index is like a directory in front of a book that accelerates the query speed of a database, which is the directory in which values in some fields are created to improve the search efficiency of the table.

By indexing we can be more efficient when querying a database.

The index is divided into:
1, normal index 2, unique index 3, primary key index (most ID) 4, full-text index.

An index can also be divided into a single-column indexed index content that is only one of the columns in the database.

A composite index is an index of many columns.

Index creation: Lter table name add index index name (column name).

Example: ALTER TABLE employee ADD index Idx_birthday (birthday).

To delete an index:

ALTER TABLE name DROP INDEX index name

Creating a composite Index: example:

Create INDEX idx_name_phoneno_ads on Student_9 (name,phoneno,address)

ALTER TABLE Student_9 Add index idx_name_phoneno_ads (name,phoneno,address)

MySQL Advanced Learning-index

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.