Alter a combination of 2 existing columns as a unique key

This is a discussion on Alter a combination of 2 existing columns as a unique key within the MySQL Database forums, part of the Database Forums category; To alter 1 column to a unique key, for example, ALTER TABLE user MODIFY COLUMN id INT NOT NULL UNIQUE; ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2007
JH
 
Posts: n/a
Default Alter a combination of 2 existing columns as a unique key

To alter 1 column to a unique key, for example,

ALTER TABLE user MODIFY COLUMN id INT NOT NULL UNIQUE;

But how to set a combination of 2 columns as a unique key?
Individual keys are not unique, but combination is.


TIA,
James

Reply With Quote
  #2 (permalink)  
Old 04-19-2007
Paul Lautman
 
Posts: n/a
Default Re: Alter a combination of 2 existing columns as a unique key

JH wrote:
> To alter 1 column to a unique key, for example,
>
> ALTER TABLE user MODIFY COLUMN id INT NOT NULL UNIQUE;
>
> But how to set a combination of 2 columns as a unique key?
> Individual keys are not unique, but combination is.
>
>
> TIA,
> James


Have you thought of looking here:
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0