我必须创建两个具有双向关系的表,如下图所示。 但它总是给出一个错误。我正在使用以下查询来创建表。
CREATE TABLE IF NOT EXISTS `rpt_operation` (
`op_id` int(45) NOT NULL,
`component` int(45) NOT NULL,
`ideal_time` time NOT NULL,
`handling_time` time NOT NULL,
PRIMARY KEY (`op_id`),
INDEX (component),
FOREIGN KEY (component)
REFERENCES rpt_component(comp_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `rpt_component` (
`comp_id` int(45) NOT NULL,
`lot_code` int(60) NOT NULL,
`lot_color` varchar(60) NOT NULL,
`drawing_num` int(60) NOT NULL,
`revision_num` int(60) NOT NULL,
`operation` int(45) NOT NULL,
PRIMARY KEY (`comp_id`),
INDEX (operation),
FOREIGN KEY (operation)
REFERENCES rpt_operation(op_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
错误出现在component int(45) NOT NULL
rpt_operation 表的行中。任何帮助将不胜感激。提前致谢