Hello, how I have a problem using the FOREIGN KEY and REFERENCES with MySQL Workbench according to the dubugger is a syntax error
CREATE TABLE IF NOT EXISTS pedidos(
id_pedido INT NOT NULL auto_increment,
fecha_pedido DATE,
cantidad_pedido INT,
id_cliente INT,
id_producto INT,
PRIMARY KEY(id_pedido)
FOREIGN KEY(id_cliente)
REFERENCES clientes(id_cliente)
FOREIGN KEY(id_producto)
REFERENCES productos(id_producto)
)ENGINE = INNODB;
I have also tried to write it in the following way:
FOREIGN KEY(id_cliente), REFERENCES clientes(id_cliente),
FOREIGN KEY(id_producto), REFERENCES productos(id_producto),
Copy Response:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN KEY (client_id) REFERENCES clients (client_id) FOREIGN KEY (id_p' at line 10
thank you very much everyone!