View Single Post

   
  #7 (permalink)  
Old 02-28-2008, 10:32 AM
Captain Paralytic
 
Posts: n/a
Default Re: Non unique primary key

On 5 Feb, 01:30, Kurda Yon <kurda...@yahoo.com> wrote:
> Hi,
>
> Is that allowed to have identical values in a column which is declared
> as "primary key". Is that true that rows of the table will be ordered
> by values of elements of the primary-key-column (in the sense that the
> MySQL server does not need order rows each time when the select
> command is used)?
>
> What should I do if I want to have my rows be ordered with respect a
> column which may have identical values?
>
> Thank you.


Having followed the conversation in this thread, I would advise you to
create a non-unique index on the column that contains the value that
you want to use in the ORDER BY. Then MySQL will use that index to
retrieve the rows in that order (as long as you code the ORDER BY
clause), if it decides that that is the most efficient method of
accomplishing the task.
Reply With Quote