* Yuen-Jeong Kim
> I read from online manual :
>
> =============================================================
> KEY is normally a synonym for INDEX. From version 4.1, the key attribute
> PRIMARY KEY may also be specified as just KEY. This was implemented for
> compatibility with other databases
> =============================================================
>
> But I think maybe KEY and INDEX same practically.
>
> If keys and indexes are not same, Could anyone let me know what
> is different between KEY and INDEX ??

KEY and INDEX is the same, the above excerpt from the manual is about the
"PRIMARY KEY" attribute used in a field definition. From 4.1 this is legal
for creating a primary key:

CREATE TABLE t1 (id int not null KEY,data varchar(255));

Before 4.1 you had to do this:

CREATE TABLE t1 (id int not null PRIMARY KEY,data varchar(255));

You can NOT do the following to make a primary key in 4.1:

CREATE TABLE t1 (
  id int not null,
  data varchar(255),
  KEY (id));

The key on 'id' will of course be a normal non-unique index in this case.

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to