Error
SQL query:
CREATE TABLE orders (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
Title varchar(255) DEFAULT NULL,
First varchar(255) DEFAULT NULL,
Middle varchar(255) DEFAULT NULL,
Last varchar(255) DEFAULT NULL,
ProductId int(11) unsigned NOT NULL,
NumberShipped int(11) DEFAULT NULL,
OrderDate date DEFAULT NULL,
PRIMARY KEY (id),
KEY order_product_fk (ProductId),
CONSTRAINT order_product_fk FOREIGN KEY (ProductId) REFERENCES products (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
MySQL said: Documentation
#1005 - Can't create table inventorymanager_2017-06-22.orders (errno: 150 "Foreign key constraint is incorrectly formed") (Details…)
Error
SQL query:
CREATE TABLE
orders(idint(11) unsigned NOT NULL AUTO_INCREMENT,Titlevarchar(255) DEFAULT NULL,Firstvarchar(255) DEFAULT NULL,Middlevarchar(255) DEFAULT NULL,Lastvarchar(255) DEFAULT NULL,ProductIdint(11) unsigned NOT NULL,NumberShippedint(11) DEFAULT NULL,OrderDatedate DEFAULT NULL,PRIMARY KEY (
id),KEY
order_product_fk(ProductId),CONSTRAINT
order_product_fkFOREIGN KEY (ProductId) REFERENCESproducts(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8
MySQL said: Documentation
#1005 - Can't create table
inventorymanager_2017-06-22.orders(errno: 150 "Foreign key constraint is incorrectly formed") (Details…)