List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 17 2001 8:34pm
Subject:Re: modifying table with sort/unique
View as plain text  
On Tue, Jul 17, 2001 at 03:34:01PM -0500, John Hunter wrote:
> >>>>> "Paul" == Paul DuBois <paul@stripped> writes:
> 
> 
>     Paul> ALTER IGNORE this_table ADD PRIMARY KEY (name,time)
> 
> They are not null so this works well with a slight modification:
> 
> ALTER IGNORE TABLE this_table ADD PRIMARY KEY (name,time)
>                ^

Oops!  My mistake.

> One further question.  Will this automatically keep my rows ordered by
> the primary key with future inserts?

Umm... no.  It will prevent duplicate records from being created, but
you don't have any control over the order in which records are stored.
That's the server's job.

To retrieve records in the order you want to see them, always use ORDER BY.

> 
> Thanks for your help,
> John Hunter
Thread
modifying table with sort/uniqueJohn Hunter17 Jul
  • Re: modifying table with sort/uniqueAlexander Skwar17 Jul
  • Re: modifying table with sort/uniquePaul DuBois17 Jul
    • Re: modifying table with sort/uniqueJohn Hunter17 Jul
      • Re: modifying table with sort/uniquePaul DuBois17 Jul