MySQL Learning summary----Index

Source: Internet
Author: User
Tags create index

MySQL Learning summary----Index

=================================================================================

First, the index

=================================================================================




=================================================================================

Ii. Creating and viewing indexes

=================================================================================

Creating and viewing indexes includes:

1) Create and view normal indexes

2) Create and view unique indexes

3) Create and view full-text indexes

4) Create and view multi-column indexes

A) Create and view normal indexes

Creating and viewing normal indexes is divided into:

1) Creating a table is to create a normal index

2) Create a normal index on a table that already exists

3) Create a normal index from the SQL statement ALTER TABLE

(i), creating a normal index when creating a table

CREATE TABLE Table name (

Property name Data type,

Property name Data type,

Property name Data type,

Index|key "Index Name" (Property name 1 "(length)" "Asc|desc")

);

Note: ASC indicates ascending, desc is descending; Index and key are used to create an index.

1. Create a table named Test in the database Doublelinux and add a normal index

Mysql> CREATE TABLE Test (

AAA int,

BBB varchar (20),

--CCC varchar (20),

-Index INDEX_AAA (AAA)

);

(ii) Create a normal index on a table that already exists

Create index index name on table name (property name "(length)" "Asc|desc")

1. Create an index named INDEX_CCC in table test01 under Database Doublelinux

Mysql> CREATE TABLE test01 (

zzz int,

-xxx varchar (20),

CCC int

);

Query OK, 0 rows affected (0.09 sec)


Mysql> CREATE index INDEX_CCC on test01 (CCC);

Query OK, 0 rows affected (0.11 sec)

records:0 duplicates:0 warnings:0


(iii),










II) Create and view unique indexes


III) Create and view full-text indexes


IV) Create and view multi-column indexes



=================================================================================

Third, delete the index

=================================================================================





This article from "Doublelinux" blog, declined reprint!

MySQL Learning summary----Index

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.