I'm doing a table creation in SQL and when executing
create table discos_compactos (
id_disco_compacto int,
titulo_cd varchar(60) not null,
id_disquera int not null,
constraint pk_discos_compactos primary key (id_disco_compacto),
constraint fk_id_disquera foreign key (id_disquera) references disqueras_cd
);
I get an error "Foreign Key constraint is incorrectly formed" the example is taken from a book but we created two tables before
CREATE TABLE TIPOS_MUSICA(
ID_TIPO INT,
NOMBRE_TIPO VARCHAR(20 NOT NULL,
CONSTRAINT UN_NOMBRE_TIPO UNIQUE (NOMBRE_TIPO),
CONSTRAINT PK_TIPOS_MUSICA PRIMARY KEY (ID_TIPO)
);
and
CREATE TABLE DISQUERAS_CD (
ID_DISQUERA INT,
NOMBRE_COMPAÑIA VARCHAR(60) DEFAULT
'Independiente' NOT NULL,
CONSTRAINT PK_DISQUERAS_CD PRIMARY KEY (ID_DISQUERA)
);
what could be wrong in the code ?, I have placed it as it appears in the example