Differences between INDEX, PRIMARY, UNIQUE, and KEY in MySQL?

  1. INDEX and KEY are the same

An index allows duplicate values and NULL values in a column. It uses a B-Tree to manage the index. The B-tree data structure lets the index quickly find a specific value, a set of values, or a range of values, corresponding to operators such as =, >, , BETWEEN, IN, and so on, in a WHERE clause.

Since B-Tree is secondary storage-friendly, the index is stored in files. The downside of using an index is that every write (insert, delete, update) to the table needs an update…