List:General Discussion« Previous MessageNext Message »
From:Benjamin Pflugmann Date:May 16 2002 4:41pm
Subject:Re: Alter table
View as plain text  
Hello.

On Thu, May 16, 2002 at 01:39:59AM +0200, admin@stripped wrote:
[...]
> > It sounds as if you want
> >
> > ALTER TABLE your_table ADD INDEX( message_id )
[...]
> Well, the FAQ is where I went first, of course. And then I came up with
> this,
> 
> "ALTER ignore table $table MODIFY message_id varchar(255) \
> not null secondary key"
> 
> But MySQL said I had an error in my syntax. :(

"secondary" is not used by MySQL. Only "primary" is a keyword. But
seeing your other response, it seems you had success meanwhile.

> If I use the ADD INDEX() syntax, will that cause the message_id
> field to be indexed, also for new message-ids?

It creates an index, and yes, new records will use the index, too.

> P.S. Yes, I know, I should have considered this when creating the
> table, that I might also want an index on message-id; but I can no
> longer drop the current table.

Well, adding indexes afterwards is quite common, as often the queries,
which need them are added later.

Bye,

	Benjamin.

-- 
benjamin-mysql@stripped
Thread
Column Header/ Column Descriptionmike markovich15 May
Re: Column Header/ Column DescriptionPaul DuBois15 May
RE: Column Header/ Column Descriptionmike markovich15 May
  • Re: Column Header/ Column DescriptionMark Matthews15 May
    • Re: Column Header/ Column DescriptionKeith C. Ivey15 May
      • Re: Column Header/ Column DescriptionMark Matthews16 May
      • Alter tableMark16 May
        • Re: Alter tableBenjamin Pflugmann16 May
        • RE: Alter tableRoger Baklund16 May
      • Re: Column Header/ Column DescriptionMikeParton16 May
      • Re: Alter tableMark16 May
        • Re: Alter tableBenjamin Pflugmann16 May
      • Re: Alter tableMark16 May
  • RE: Column Header/ Column DescriptionGurhan Ozen15 May
RE: Column Header/ Column DescriptionPaul DuBois15 May
RE: Column Header/ Column Descriptionmike markovich15 May
RE: Column Header/ Column DescriptionSteve Orr16 May
  • Re: Column Header/ Column DescriptionMark Matthews16 May