Amigos, estoy creando dos bases de datos, y una de ellas me ha dado problemas para vincular llaves foraneas desde la tabla subcategorias a inventario. Lo que asumo como relación muchos items de inventario a cada campo de categoría.
Los outputs que me salen son estos pero aún no los descifro, si alguien nota algo que aún yo no, le agradezco.
CREANDO COLUMNA
Column name: id_inventario
Datatype: INT
CREANDO LLAVE PRIMARIA
Index name: id_subcatinven_idx
Type: INDEX
Index Column: id_inventario
CREANDO LLAVE FORANEA
Foreign Key Name: fk_subcat_inven
Referenced Table:
Column: AQUI TRATO DE SELECCIONAR id_inventario Y LA CASILLA NO PERMITE HACER CHECK
Ya es claro que lanzar la sentencia aquí es inutil por estar incompleta pero sale esto:
SENTENCIA:
ALTER TABLE `tdreal`.`subcategorias`
ADD CONSTRAINT `fk_subcat_inven`
FOREIGN KEY ()
REFERENCES `tdreal`.`inventario` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION;
OUTPUT:
Operation failed: There was an error while applying the SQL script to the database.
Executing:
ALTER TABLE `tdreal`.`subcategorias`
ADD CONSTRAINT `fk_subcat_inven`
FOREIGN KEY ()
REFERENCES `tdreal`.`inventario` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION;
ERROR 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 ')
REFERENCES `tdreal`.`inventario` ()
ON DELETE NO ACTION
ON UPDATE NO ACT' at line 3
SQL Statement:
ALTER TABLE `tdreal`.`subcategorias`
ADD CONSTRAINT `fk_subcat_inven`
FOREIGN KEY ()
REFERENCES `tdreal`.`inventario` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION