SQL Foreign Keys

From Kb

Revision as of 03:49, 15 September 2010 by Jonathan (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

How to drop a Foreign Key from a table:

ALTER TABLE `tablename` DROP FOREIGN KEY `fk_name`;

Note: in the table definition the FK is also known as the CONSTRAINT

How to drop a Key from a table:

ALTER TABLE `tablename` DROP KEY `k_name`;