Page 1 of 1

Changing PRIMARY KEY

Posted: Sat Sep 08, 2007 9:30 am
by icesolid
My Indexes section in phpMyAdmin for my table looks like this:

Code: Select all

Keyname     Type         Cardinality    Action     Field
PRIMARY    PRIMARY            7                     id
                                                    control_number
How do I remove the control_number from that?

I want the control_number field to be my FOREIGN KEY, I do not know how I ended up doing this. :roll:

Posted: Sat Sep 08, 2007 9:48 am
by josa
If you click the edit icon under Action, chose -- Ignore -- in the drop down for control_number and then click save, it should go away.

/josa

Posted: Sat Sep 08, 2007 9:49 am
by icesolid
To add a foreign key all I need is this code correct?

Code: Select all

ALTER TABLE ba_forms ADD FOREIGN KEY (control_number) REFERENCES cases(control_number)
Because whenever I run that code above I just get control_number as INDEX in ba_forms.

I am running MyISAM, is FOREIGN KEYS only supported in InnoDB?

Posted: Sat Sep 08, 2007 11:14 am
by josa
As far as I know - yes.

/josa