A table index helps SQL statements run faster. The syntax for creating an index is:
CREATE INDEX IDX_CUSTOMER_LAST_NAME
on CUSTOMER (Last_Name)
on CUSTOMER (Last_Name)
Copying table:
CREATE TABLE copyname SELECT * FROM originalname
Creating key across multiple columns :
alter table tbl_name add primary key(col1,col2,col3);
If there are duplicates rows in a db across this combination:
alter ignore table judgments add unique index `idx_nm` (col1,col2,col3);
and then drop the idx: alter ignore table judgments drop idx_name
Connections:
Q)How to check the number of connections to a db ?
A) show processlist;
Q)How to see the current indexes?
A) show indexes from table_name;