I am having problems with 2 tables.
I just created a table called "ejemplar" with the following SQL code:
CREATE TABLE ejemplar
(
id_revista INT NOT NULL,
id_ejemplar INT NOT NULL,
id_art INT NOT NULL,
fecha_ejem VARCHAR (30),
precio_ejem decimal,
num_pag_ejem INT,
PRIMARY KEY (id_revista,id_ejemplar,id_art),
FOREIGN KEY (id_revista) REFERENCES revista (id_rev)
)
And I want to create a table called "ejem_art" with the following SQL code:
CREATE TABLE ejem_art(
id_rev INT NOT NULL,
id_ejem INT NOT NULL,
id_art INT NOT NULL,
num_pag INT,
PRIMARY KEY (id_rev,id_ejem,id_art),
FOREIGN KEY (id_rev) REFERENCES revista (id_rev),
FOREIGN KEY (id_ejem) REFERENCES ejemplar (id_ejemplar),
FOREIGN KEY (id_art) REFERENCES articulo (id_art)
);
The DBMS is MySQL and as you can see I have the same type of data in the PK and FK fields in both tables.
When I try to run the second SQL code after creating the table "ejemplar" MySQL shows the famous errno: 150 which relates to different type of data or even different engine rather than InnoDB.
I have made sure both things are correct (same data type and same engine) but I still cannot run the second code.
Hope you could help me with this, because I would not want to make an "Alter Table" just because of this error.
Thanks in advance!