error # 1005 - Can not create table (errno: 150)

1

I try to create a table that refers to a foreign key that I created earlier, the statement of my instruction goes like this:

create table IF NOT EXISTS opcion(
    id_opcion varchar(21) not null,
    id_pregunta varchar (21)not null,
    primary key(id_opcion),
    FOREIGN KEY(id_pregunta) REFERENCES pregunta(id_pregunta),
    c_opcion varchar(255)
);

and the result indicated is this

  

1005 - Can not create table 'encuesta_egresados.opcion' (errno: 150) (Details ...)

Next I show you an image where the structure of the table to which I refer is shown.

  

Note earlier in the table used the attribute id instead of id_question, I do not know if that interferes

    
asked by jDanielSotoC 05.10.2017 в 17:00
source

0 answers