At 11:55 -0700 9/23/02, johnbarri wrote:
>Hi - I'm a mysql newbie.  As I've yet to discover a method of batching mysql
>commands I prefer to input lengthy instructions (such as large file
>structures) in stages, so input errors can be dealt with more easily.  For
>example, I first define table structures and then indexes.
>
>This led me to use "create index" for the latter.  The following syntax
>"create index city_idx on city_country_masterfile (city);"  worked  for an
>ordinary index definition.
>
>However, when  I wanted to define the fourth column (pkey) as a primary key
>I could not get create index to work - I misunderstood the syntax or was
>misapplying "create index".

CREATE INDEX cannot create a PRIMARY KEY.  It has no syntax for it.
DROP INDEX won't drop a PRIMARY KEY, either.

>
>What finally worked for me was "alter table city_country_masterfile add
>primary key (pkey);".

That's what you need to do.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to