Different type of INDEXES in database / Primary Key - Unique Key
I suppose you might be aware of the concept of Database Indexing .If you are not, please read about how Indexes works.
In this post my main focus is to let you know the differences between different types of Indexes.
Normal Indexes :
These are the most basic indexes, and have no restraints such as uniqueness or Null value.
Unique Indexes :
Unique indexes are the same as Normal indexes with one difference: all values of the indexed column(s) must only occur once.
Unique indexes allow null values in it’s columns if they allow null values. You can name it according to your choice. In the example i am using name my_uniq_index .
Primary Keys/Indexes :
Primary keys are unique indexes that must be named PRIMARY.You may only have one primary key per table.
If you are using AUTO_INCREMENT then that column must be defined as PRIMARY key. Unlike Unique key it doesn’t allow NULL values.