Adding an index to a table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Simon Jackson

    Adding an index to a table

    I am trying to convert a column to a unique column. Tried to look at some
    examples on-line but failed to find the correct syntax I need. So, while I'm
    waiting for my SQL book to arrive, a pointer would be nice. This is what I
    have so far....

    ALTER TABLE member MODIFY username UNIQUE

    What am I missing?


  • matty

    #2
    Re: Adding an index to a table

    Simon Jackson wrote:
    [color=blue]
    > I am trying to convert a column to a unique column. Tried to look at some
    > examples on-line but failed to find the correct syntax I need. So, while
    > I'm waiting for my SQL book to arrive, a pointer would be nice. This is
    > what I have so far....
    >
    > ALTER TABLE member MODIFY username UNIQUE
    >
    > What am I missing?[/color]

    alter table member add unique index idx_username (username);

    Comment

    Working...