Error 1005 when creating foreign key
am 24.05.2006 11:25:20 von Milwell Sia--0-740346183-1148462720=:47813
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
the following script produces an error:
error no. 1005
can't create table ...
MySQL version: 5.0
MySQL Query Browser version: 1.1.2
DROP TABLE IF EXISTS `hr`.`area`;
CREATE TABLE `hr`.`area` (
`ID` int(11) NOT NULL,
`DESCRIPTION` varchar(100) NOT NULL,
`STATUS` smallint(6) NOT NULL default '1',
PRIMARY KEY (`ID`),
UNIQUE KEY `Index_2` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `hr`.`employee`;
CREATE TABLE `hr`.`employee` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(45) NOT NULL default '',
`area` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `Index_2` (`area`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `hr`.`employee` ADD CONSTRAINT `FK_employee_1` FOREIGN KEY `FK_employee_1` (`area`)
REFERENCES `area` (`ID`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--0-740346183-1148462720=:47813--