Indexes

Overview

  • Indexes have not been standardized in SQL
  • The syntax may vary from one database engine to another

create

create [unique | fulltext | spatial] index index_name [index_type]
on tbl_name (col_name [(length)] [asc | desc], ...);
alter [ignore] table tbl_name
add index [index_name] [index_type] (col_name [(length)] [asc | desc], ...);
Examples
create index customer_id_index
on customer (customer_id asc);
alter table customer
add index customer_id_index (customer_id asc);

drop

drop index index_name
on tbl_name;
alter [ignore] table tbl_name
drop index index_name;