Indexes 1.speedup search on indexed columns. (is the primary optimization technique) 2.some enforce uniqueness. Index and Unique can be named. Primary Key cannot be named (its name is Primary). Can be multiple Indexes and Uniques but only one Primary Key. All can be composite. Index index is non-unique; for retrieval speedup purposes only. create table t1 (..., fi datatype,..., INDEX [indexname] (fi)) #can name it CREATE INDEX indexname ON t1 (fi) #must name it alter table t1 Add INDEX [indexname] (fi) alter table t1 Drop INDEX indexname|fi DROP INDEX indexname ON t1 #name must be used Foreign Key is an Index. Unique index uniqueness enforced but if column can have Null then multiple Nulls are allowed. create table t1 (..., fi datatype UNIQUE, ...) #if one column only create table t1 (..., fi datatype,..., UNIQUE [indexname] (fi)) #can name it alter table t1 Add UNIQUE [indexname] (fi) alter table t1 Drop INDEX indexname|fi #must use indexname if has one CREATE UNIQUE INDEX indexname ON t1 (fi) #must name it DROP INDEX indexname ON t1 #name must be used Primary Key index is unique, non-null. Equivalent to Unique and Not Null. create table t1 (..., fi datatype PRIMARY KEY, ...) #if one column only create table t1 (..., fi datatype,..., PRIMARY KEY(fi)) alter table t1 Add PRIMARY KEY(fi) alter table t1 Drop PRIMARY KEY CREATE|DROP INDEX can not do Primary Key Information about table's indexes: Desc t; Show Create Table t; SHOW INDEX FROM t [FROM db];