Hi guys,
I know PRIMARY key is to have unique value, what about INDEX? What is the function of a table column with INDEX?
Hi guys,
I know PRIMARY key is to have unique value, what about INDEX? What is the function of a table column with INDEX?
INDEX columns are exactly that. They're indexed to make it faster to look up information using that column. MySQL typically stores Indexes in B-Trees or R-Trees. An appropriate case for the use of an index would be if you're using a where clause on a particular column (or group of columns) regularly.
Indexes are a topic worthy of whole chapters in database books, a good place to start looking for more information might be the mysql reference manual.
An INDEX in MySQL, performs the same kind of function an INDEX does at the end of a book. It enables faster lookup for your information when you do a query like:
SELECT * FROM MY-DB-WITH-INDEXES> WHERE <INDEX_FIELD=foo_bar>
Good choice of the columns used to form an index always makes a good database design.