SQL CREATE TABLE index CREATE INDEX () statement

Source: Internet
Author: User
Tags create index mssql server mysql create mysql tutorial mysql create index

SQL CREATE TABLE index CREATE INDEX () statement

MSSQL Server method
Grammar:
Create [Index type] Index name
On table name (column name)
With FILLFACTOR = fill factor value 0~100
Go


Instance

Create nonclustered index Ix_test_tname--Creating a nonclustered indexes
On test (Tname)--Creates an index for the Tname field of the test table
With FILLFACTOR = 30--fill factor is 30%
Go

SELECT * FROM Test (index = ix_test_tname) where tname = ' a '


MySQL Tutorial method

MySQL CREATE INDEX syntax

Create [unioun|fulltext|spatial] index indexname[using Indextype] on

TableName (Tablenamecol)

Index_col_name:

col_name[(length)][asc |desc]

For more details please see: http://www.111cn.net/database/110/mysql-crate-

Index.htm

Instance

Create INDEX instance
This example creates a simple index, named "Personindex," in the LastName column of the person table

CREATE INDEX Personindex
On person (lastname)
If you want to index the values in a column in descending order, you can add the reserved word desc after the column name:

CREATE INDEX Personindex
On person (LastName DESC)
If you want to index more than one column, you can list the names of these columns in parentheses, separated by commas:

CREATE INDEX Personindex
On person (LastName, FirstName)

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.