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)