MySQL Statement index operation

Source: Internet
Author: User
Tags create index

CREATE INDEX: (help create index;)

CREATE INDEX IndexName on TableName (Coll,coll ...);

ALTER TABLE tableName ADD INDEX indexname (coll,coll);

eg
Federated Index:
Create INDEX sage_sdept on student (SAGE,SDPT (10))
Create INDEX d_a_p on student (Dateline,ader (), POS (20));

To delete an index:

ALTER TABLE tableName DROP indexname;

DROP INDEX indexname on TableName;

To view the index of a table:

Mysql> Show index from proc;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+--- ---+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+--- ---+------------+---------+---------------+
| Proc | 0 | PRIMARY | 1 | db | A | NULL | NULL | NULL | | BTREE | | |
| Proc | 0 | PRIMARY | 2 | name | A | NULL | NULL | NULL | | BTREE | | |
| Proc | 0 | PRIMARY | 3 | Type | A | 48 | NULL | NULL | | BTREE | | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+--- ---+------------+---------+---------------+
3 Rows in Set (0.00 sec)

MySQL Statement index operation

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.