I'm trying to create a table, but I have a problem with a foreign key, at least it's what it looks like and that's what I can understand in my searches.
Look at the code, the error occurs in the last table.
(I found several similar posts but tried the suggestions and did nothing)
CREATE TABLE Professor(
ra INT NOT NULL
,apelido VARCHAR(30) NOT NULL
,nome VARCHAR(120) NOT NULL
,email VARCHAR(80) NOT NULL
,celular CHAR(11) NOT NULL
,CONSTRAINT pkra PRIMARY KEY (ra)
,CONSTRAINT uqapelido UNIQUE (apelido)
);
CREATE TABLE Curso(
sigla VARCHAR(5) NOT NULL
,nome VARCHAR(50) NOT NULL
,CONSTRAINT pksigla PRIMARY KEY (sigla)
,CONSTRAINT uqnome UNIQUE (nome)
);
CREATE TABLE GradeCurricular(
sigla_curso VARCHAR(5) NOT NULL
,ano SMALLINT NOT NULL
,semestre CHAR(1) NOT NULL
,CONSTRAINT fksigla_curso FOREIGN KEY (sigla_curso) REFERENCES Curso (sigla)
,PRIMARY KEY (sigla_curso,ano,semestre)
);
CREATE TABLE Periodo(
sigla_curso VARCHAR(5)
,ano_grade SMALLINT
,semestre_grade CHAR (1)
,numero TINYINT NOT NULL
,CONSTRAINT fk_sigla_curso FOREIGN KEY (sigla_curso) REFERENCES GradeCurricular (sigla_curso)
,CONSTRAINT fk_ano_grade FOREIGN KEY (ano_grade) REFERENCES GradeCurricular (ano)
,CONSTRAINT fk_semestre_grade FOREIGN KEY (semestre_grade) REFERENCES GradeCurricular (semestre)
,PRIMARY KEY (sigla_curso,ano_grade,semestre_grade,numero)
);