Example of creating an index in MySQL

Source: Internet
Author: User
Tags mysql create mysql create index mysql index


MySQL index creation example environment: MySQL Sever 5.1 + MySQL command line tool problem: create index Syntax: CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name [index_type] www.2cto.com ON tbl_name (index_col_name ,...) [index_type] index_col_name: col_name [(length)] [ASC | DESC] index_type: USING {BTREE | HASH | RTREE} example: [SQL] -- create table testIndex (id int not null primary key, name varchar (10); www.2cto.com -- create normal index creat E index IDX_test_testIndex _ Name on testIndex (name); Note: it is best to use this method for index naming: IDX_databaseName_tableName_columnName (IDX indicates index, databaseName indicates Database Name, tableName indicates table name, columnName indicates the field name. If there is no database concept in Oracle, replace it with the tablespace, so replace databaseName with the user name ). Reference: MySQL Create Index method and syntax structure and example http://www.bkjia.com/database/201209/155472.html

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.