You cannot name a PRIMARY KEY. The name PRIMARY KEY is the designation of the arbitrary, or preferred, unique index ([**candidate key**][1]) for accessing the table. A table can have multiple unique keys, but only one PRIMARY KEY.

EXAMPLE: Employee table with three unique keys

- EmployeeID
- Driver's License Number
- Social Security Number

You can pick a name out of a hat, flip a coin, or ask project managers which one of the three indexes should be the PRIMARY KEY.

You can create a unique index without it being the PRIMARY KEY as follows:

    create table a (foo INTEGER, UNIQUE KEY foo_id (foo)); 

Check these other links about PRIMARY KEYs vs Unique Keys

- http://dba.stackexchange.com/questions/1355/why-do-primary-keys-have-names-of-their-own
- http://dba.stackexchange.com/questions/9265/what-is-the-point-of-a-primary-key

As for the other question: the Index Type

By default, the [*MEMORY storage engine*][2] uses HASH as the index_type. You could specify BTREE as the index type. However, it tends to bloat more than HASH indexes.

By default, the index_type for MyISAM and InnoDB is BTREE. (Bad News: [MyISAM and InnoDB DO NOT SUPPORT HASH INDEXES. YOU HAVE TO EMULATE IT][3])


  [1]: http://en.wikipedia.org/wiki/Candidate_key
  [2]: http://dev.mysql.com/doc/refman/5.5/en/memory-storage-engine.html
  [3]: http://dba.stackexchange.com/a/2818/877