Ver originalCREATE TABLE product ( category INT NOT NULL, id INT NOT NULL, price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB; CREATE TABLE customer ( id_customer INT NOT NULL, PRIMARY KEY (id_customer)) ENGINE=INNODB;
Ver originalCREATE TABLE product_order ( category INT NOT NULL, id INT NOT NULL, id_customer INT NOT NULL, PRIMARY KEY ( category, id, id_customer)KEY ( category, id)KEY ( id_customer)FOREIGN KEY (category, id, id_customer) REFERENCES product (category, id)) ENGINE=INNODB;