Mysql -- index,

Source: Internet
Author: User

Mysql -- index,
1. Create and view Indexes

Common indexes are created without any restrictions (unique or non-empty ). This type of index can be created on any data type field.

(1) create a common index when creating a table

  • Syntax:

  • Example:

(2) create a common index on an existing table

Syntax:

Example:

2. Create and view unique Indexes

(1) create a unique index when creating a table

  • Syntax:

  • Example:

(2) create a unique index on an existing table

  • Syntax:

  • Example:

(3) Use the SQL statement ALTER TABLE to create a unique index

  • Syntax:

  • Example:

3. Create and view full-text indexes

Full-TEXT indexes are mainly associated with fields with CHAR, VARCHAR, and TEXT data types, so that you can query string fields with large data volumes more quickly.

(1) create a full-text index when creating a table

  • Syntax:

  • Example:

(2) create a full-text index on an existing table

  • Syntax:

  • Example:

(3) Use the SQL statement ALTER TABLE to create a full-text index

  • Syntax

  • Example

4. delete an index
  • Syntax:

  • Example:

 

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.