mysql error in creating foreign key

1

I'm trying to create a foreign key, but it's an error. Here is the code I'm using:

 CREATE TABLE foto(
    id INT(10),
    img varchar(25),
    nome varchar(25),
    link varchar(25),
    vew INT(10),
    tkm VARCHAR(100),
    moder INT(1),
    CONSTRAINT fot_id_pk
    PRIMARY KEY (id)
);
 CREATE TABLE inter(
        id INT(10),
        img varchar(25),
        nome varchar(25),
        link varchar(25),
        vew INT(10),
        tkm VARCHAR(100),
        moder INT(5),
        CONSTRAINT int_id_pk
        PRIMARY KEY (id),
        CONSTRAINT int_moder_fk
        FOREIGN key (moder)
        REFERENCES foto (moder)
    );

error:

    
asked by anonymous 17.07.2018 / 21:50

1 answer

2

The problem is that the columns are incompatible.

Column in the photo table: moder INT(1)
Column in inter-table: moder INT(5)

    
17.07.2018 / 22:00