Ce inseamna KEY la creare tabel in MySQL

Discutii despre script-uri si coduri PHP-MySQL, precum si lucru cu XML in PHP.
patricia
Mesaje:82

Ce inseamna KEY la creare tabel in MySQL

Ce inseamna cand creezi un tabel, cand in dreptul unei coloane pui cuvantul KEY, daca PRIMARY KEY identifica in mod unic fiecare rand din tabel, KEY ce reprezinta?

Cod: Selectaţi tot

CREATE TABLE news (
	id int(11) NOT NULL AUTO_INCREMENT,
	title varchar(128) NOT NULL,
	slug varchar(128) NOT NULL,
	text text NOT NULL,
	PRIMARY KEY (id),
	KEY slug (slug)
);

MarPlo Mesaje:4343
Din ce am citit pe net, KEY e un sinonim pentru INDEX, dar KEY ar fi deprecat /nefolosit in MySQL 5.5+.
In documentatia MySQL de la adresa:
dev.mysql.com/doc/refman/5.1/en/create-table.html
Se specifica:
KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems.
...
index_option values specify additional options for an index. USING is one such option.

Subiecte similare