what is difference between all major keys in mysql

 

Normally used keys in mysql are
Index key
Secondary key
Primary key
Unique key
Foreign key
Index key is used for fast seraching and processing in table and database . it works like as we find index in the end of book where we can find different indexes and we can find easily every topic of our choice and can go where ever we wanna to go with related page mentioned on the book. It is really helpful and beneficial for query processes. There can be many indexes in a table as well as in a database.

Primary key :
It is unique key and can never be null. It has one value always and can not be assigned or inserted anywhere else in database.It is also used for processing purposes.The difference between index key and primary key is that  it is only one key in a database. it has one value and if it has found anywhere the same value ; It would prompt your primary key data structure error.
but index key , there can be many index keys in a table .

Unique key:

Unique key means that the value in the same row cannot be same. as per when we do not want that same email address can be made again by another user we use unique key.

Secondary key :
it is alias type key we use it for another purpose of index or foreign key.

Foreign key :
We use foreign key when we want to relation one table strucure or entity of
table with another table ; now there would come constraint , the value updated in one table must be updated
respectively in another table.