If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Drop unique

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-05, 09:31
pearl2 pearl2 is offline
Registered User
 
Join Date: Nov 2003
Location: Sinapore
Posts: 187
Drop unique key

Hi,

I've a table with two unique keys on the same column. I've no idea how the second one came about. Here's is a partial output from show create table profiles:

Code:
Create Table: CREATE TABLE 'profiles' {
  ...
  UNIQUE KEY 'email' (email),
  UNIQUE KEY 'email_2' (email)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
How do I drop the second unique key?

Thanks in anticipation

Last edited by pearl2; 10-24-05 at 09:37.
Reply With Quote
  #2 (permalink)  
Old 10-24-05, 10:30
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
Code:
ALTER TABLE `profiles` DROP INDEX `email_2`
Reply With Quote
  #3 (permalink)  
Old 10-24-05, 10:42
pearl2 pearl2 is offline
Registered User
 
Join Date: Nov 2003
Location: Sinapore
Posts: 187
Hi jfulton,

Thanks I tried but it didn't work: ERROR 1064 (42000): You have an error in your SQL syntax; check....at line 1".

Edited:

Works without the single quotes around email_2

Thanks

Last edited by pearl2; 10-24-05 at 10:45.
Reply With Quote
  #4 (permalink)  
Old 10-24-05, 11:52
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
Those are not single quotes above, they are backticks (to the left of the 1 and exclamation key on your keyboard).
Reply With Quote
  #5 (permalink)  
Old 10-25-05, 04:15
pearl2 pearl2 is offline
Registered User
 
Join Date: Nov 2003
Location: Sinapore
Posts: 187
Ah, I see.

Thanks, guelphdad
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On