I have one table called 'taxanomy'
CREATE TABLE `taxanomy`(
id int not null AUTO_INCREMENT,
title varchar(255) not null,
type varchar(255) not null,
PRIMARY KEY(id, title)
);
And another one called 'taxanomy_relationship'
CREATE TABLE taxanomy_relationship(
id INT AUTO_INCREMENT,
post_id int not null,
title varchar(255) not null,
PRIMARY KEY(id),
FOREIGN KEY (title)
REFERENCES taxanomy(title)
ON DELETE CASCADE
ON UPDATE CASCADE
);
In 'taxanomy' table i have two primary key column (id, title).
what i want to do is that to make a connection between "title columns" in both tables with primary key and foreign key but when i want to create it, it throws an error:
1005 - Can't create table taxanomy_relationship
(errno: 150 "Foreign key constraint is incorrectly formed")
WHY?