0

I have copied the create statement to clipboard. Its showing

Key portion:

PRIMARY KEY (ID), KEY contID (contID)

What does the KEY refers to and What type of KEY it is?

Cynosure
  • 161
  • 2
  • 3
  • 9

2 Answers2

2

KEY creates an index (or key) on the column for faster look up on that column in queries. Generally you would use KEY on a column that is used in joins and WHERE clauses.

http://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html

Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
2

From 13.1.14. CREATE TABLE Syntax

{INDEX|KEY}

KEY is a synonym for INDEX

8.3.2. Using Primary Keys

The PRIMARY KEY for a table represents the column or set of columns that you use in your most vital queries. It has an associated index, for fast query performance.

peterm
  • 91,357
  • 15
  • 148
  • 157